Trying to get my WSDD service going, using BidBuy as an example. To pass data
between client/server I created a "User" class that holds some data.

Now, when sending data from client to server, this is what I see:

POST /axis/services/ValidateFields HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 765

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> 
      <soapenv:Body>  
         <validateUserData
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>   
            <data href="#id0"/>  
         </validateUserData>  
         <multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xsi:type="ns1:User" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:ns1="http://localhost/axis/services/ValidateFields";>   
            <name xsi:type="xsd:string">smaclure</name>   
            <phoneNumber xsi:type="xsd:string">02076545987</phoneNumber>  
         </multiRef> 
      </soapenv:Body>
   </soapenv:Envelope> 

returns:

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Date: Fri, 05 Sep 2003 15:11:30 GMT
Server: Apache Coyote/1.0
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> 
      <soapenv:Body>  
         <soapenv:Fault>   
            <faultcode>soapenv:Server.userException</faultcode>   
            <faultstring>org.xml.sax.SAXException: Deserializing parameter
&apos;data&apos;:  could not find deserializer for type
{http://localhost/axis/services/ValidateFields}User</faultstring>   
            <detail/>  
         </soapenv:Fault> 
      </soapenv:Body>
   </soapenv:Envelope>

At the moment, my deploy.wsdd looks like this;

<deployment xmlns="http://xml.apache.org/axis/wsdd/"; 
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"; 
xmlns:ValidateFields="http://localhost:8080/axis/services/ValidateFields"; 
xmlns:reg="http://www.soapinterop.org/Registry";>
  <service name="ValidateFields" provider="java:RPC">
    <namespace>http://localhost:8080/axis/services/ValidateFields</namespace>
    <parameter name="className" value="example2.ValidateFields"/>
    <parameter name="allowedMethods" value="*"/>
  </service>
  <beanMapping qname="ValidateFields:User"
languageSpecificType="java:example2.User"/>
</deployment>

I'm a bit confused as I searched this list and found a few related queries, but
their deployment syntax is different from the 'bidbuy' example.

So, I need a bit of a push in the right direction - am I doing the right thing?
My client code looks like this:

/*
        Scott's test
 */

package example2 ;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import java.util.Map;

public class ValidateFieldsClient
{
   public static void main(String [] args) throws Exception {


       //String endpoint = "http://localhost:8080/axis/ValidateFields.jws";;
                String endpoint = "http://localhost/axis/services/ValidateFields";;
       
       String name = "Scott";
       

       Service  service = new Service();
       Call     call    = (Call) service.createCall();

                // test # 1
       call.setTargetEndpointAddress( new java.net.URL(endpoint) );
       call.setOperationName( "helloTest" );
       call.addParameter( "name", XMLType.XSD_STRING, ParameterMode.IN );
       call.setReturnType( XMLType.XSD_STRING );

                String ret = "";
                try
                {
                ret = (String) call.invoke( new Object [] { name });
                }
                catch(Exception e)
                {
                        e.printStackTrace();
                }
        System.out.println("Got result : " + ret);
        
        // test #2
        
                //      register the User class
                QName uqn = new QName(endpoint, "User");
                Class cls = User.class;
                call.registerTypeMapping(cls, uqn, BeanSerializerFactory.class,
BeanDeserializerFactory.class);
        
        call.removeAllParameters(); // reset for next call
                call.setOperationName( "validateUserData" );
                call.addParameter( "data", uqn, ParameterMode.IN );
                call.setReturnType( XMLType.XSD_ANY ); // not sure about this
                
                User user = new User("smaclure", "02076545987");

                Map usrData = null;
                try
                {
                        usrData = (Map)call.invoke( new Object [] { user });
                }
                catch(Exception e)
                {
                        e.printStackTrace();
                }
                System.out.println("Got userinfo : " + usrData.toString());
   }
}

(test #1 works fine)

thanks,
Scott

Reply via email to