错误信息如下:
org.xml.sax.SAXException: Deserializing parameter 'result':  could not find deserializer for type {http://wynner/xxx/ds/message/}GetX

解决方案 »

  1.   

    首先确认到底是不是字符串类型,如果是则应该不会导致序列化错误,估计是复杂类型,通过查看WSDL文档或者WSDD可以看到是什么类型.
        你的
        call.addParameter("b1",qname,javax.xml.rpc.ParameterMode.IN);
        call.addParameter("result",qname,javax.xml.rpc.ParameterMode.INOUT);
    用同一个qname,qname是同webservice的发布相对应的,一个java参数对应消息中的一个qname我是入门级别,因此不要太相信.
      

  2.   

    你那个result定义的时候应该这样吧,String result="";或者String result=new String(""); null是非序列化对象。
      

  3.   

    TO study_body(珍惜每一天):
    GetX(BSTR b1,BSTR* result)的第二个参数是一个输出参数,参数类型为字符串
    WSDL中的描述是类型描述是 xsd:string 
    另外,qname我不太明白你的意思,这些参数都是在同一名字空间下的.to  junnef(光明圣堂武士):
    你说的这些我都试过了,还是不行.
    另外:
    我用VC和VB又各写了一个客户端,其中VB的调用和返回都是成功的.
      

  4.   

    说一句实话,我都是自己学的,所以可能理解有问题.
    call.addParameter("b1",qname,javax.xml.rpc.ParameterMode.IN);
    qname不是对应你的远程service的GetX方法的某个参数嘛?
    将call.addParameter("result",qname,javax.xml.rpc.ParameterMode.INOUT);更改成QName serviceName = new QName("http://wynner/xxx/message/",yourservicename);
    call.addParameter("result",serviceName,javax.xml.rpc.ParameterMode.INOUT);另外再说两句,你的service的方法的参数的名字是result,好像soap将函数的返回值默认的名字为result不知道这会不会导致冲突,不过你能够用其他客户端实现,说明你的
    service没有问题,能贴出你用其他客户端测试成功后返回的soap消息吗?
      

  5.   

    addParameter
    public void addParameter(QName paramName,
                             QName xmlType,
                             ParameterMode parameterMode)Adds the specified parameter to the list of parameters for the operation associated with this Call object. Note: Not part of JAX-RPC specification. Parameters:
    paramName - Name that will be used for the parameter in the XML
    xmlType - XMLType of the parameter
    parameterMode - one of IN, OUT or INOUT其中xmlType是参数的XMLType ,而不是操作方法的XMLType 吧,不知道我说的对不对
      

  6.   

    addParameter
    public void addParameter(QName paramName,
                             QName xmlType,
                             ParameterMode parameterMode)Adds the specified parameter to the list of parameters for the operation associated with this Call object. Note: Not part of JAX-RPC specification. Parameters:
    paramName - Name that will be used for the parameter in the XML
    xmlType - XMLType of the parameter
    parameterMode - one of IN, OUT or INOUT其中xmlType是参数的XMLType ,而不是操作方法的XMLType 吧,不知道我说的对不对
      

  7.   

    我的QName是这样的呀,有什么问题吗?
    QName qname = new QName(
            "http://wynner/xxx/message/",
            "GetX");
      

  8.   

    另外,我用VC写的客户端也调用成功了我想可能是我的输出参数 BSTR* result 是一个二级指针,所以Java不认识?可是这个二级指针是一个标准的字符串啊
      

  9.   

    我的WSDL内容如下<?xml version='1.0' encoding='UTF-8' ?>
    <definitions
    name='SCT'
    targetNamespace='http://wynner/SCT/wsdl/'
    xmlns:wsdlns='http://wynner/SCT/wsdl/'
    xmlns:typens='http://wynner/SCT/type/'
    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
    xmlns:xsd='http://www.w3.org/2001/XMLSchema'
    xmlns:stk='http://schemas.microsoft.com/soap-toolkit/wsdl-extension'
    xmlns:dime='http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/'
    xmlns:ref='http://schemas.xmlsoap.org/ws/2002/04/reference/'
    xmlns:content='http://schemas.xmlsoap.org/ws/2002/04/content-type/'
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
    xmlns='http://schemas.xmlsoap.org/wsdl/'> <types>
    <schema
    targetNamespace='http://wynner/SCT/type/'
    xmlns='http://www.w3.org/2001/XMLSchema'
    xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
    elementFormDefault='qualified'> <import namespace='http://schemas.xmlsoap.org/soap/encoding/'/>
    <import namespace='http://schemas.xmlsoap.org/wsdl/'/>
    <import namespace='http://schemas.xmlsoap.org/ws/2002/04/reference/'/>
    <import namespace='http://schemas.xmlsoap.org/ws/2002/04/content-type/'/> </schema>
    </types> <message name='Speaker.GetMax'>
    <part name='a' type='xsd:int'/>
    <part name='b' type='xsd:int'/>
    </message> <message name='Speaker.GetMaxResponse'>
    <part name='result' type='xsd:int'/>
    </message> <portType name='SpeakerSoapPort'> <operation name='GetMax' parameterOrder='a b result'>
    <input message='wsdlns:Speaker.GetMax'/>
    <output message='wsdlns:Speaker.GetMaxResponse'/>
    </operation> </portType> <binding name='SpeakerSoapBinding' type='wsdlns:SpeakerSoapPort' > <stk:binding preferredEncoding='UTF-8'/>
    <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='GetMax'>
    <soap:operation soapAction='http://wynner/SCT/action/Speaker.GetMax'/>
    <input>
    <soap:body
    use='encoded'
    namespace='http://wynner/SCT/message/'
    encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
    parts='a b'/>
    </input>
    <output>
    <soap:body
    use='encoded'
    namespace='http://wynner/SCT/message/'
    encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
    parts='result'/>
    </output>
    </operation> </binding> <service name='SCT' >
    <port name='SpeakerSoapPort' binding='wsdlns:SpeakerSoapBinding' >
    <soap:address location='http://wynner/sct/SCT.WSDL'/>
    </port>
    </service></definitions>
      

  10.   

    我玩的时候都是用java写的webservice不过用什么写应该没有关系啊.
    看你的wsdl文档的消息部分全都是xsd:int啊,我知道的不多,还是请高人指导吧.
    com我不懂,二级指针我更不懂,如果能贴出你用vc调用返回的soap消息就很清楚了.
      

  11.   

    我想可能是我的输出参数 BSTR* result 是一个二级指针,所以Java不认识?   我觉得不是,因为他与客户端可以说是一点关系也没有啊,java关心的是怎样构造一个soap消息吧!目前AXIS支持的java bean同复杂类型的映射,更支持多维数组,因此我觉得在你的问题中应该不存在这个问题(我觉得).
      

  12.   

    不好意思,上面的那个WSDL错了,应该是这个才对.
    <?xml version='1.0' encoding='UTF-8' ?>
    <definitions
    name='SCT'
    targetNamespace='http://wynner/SCT/wsdl/'
    xmlns:wsdlns='http://wynner/SCT/wsdl/'
    xmlns:typens='http://wynner/SCT/type/'
    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
    xmlns:xsd='http://www.w3.org/2001/XMLSchema'
    xmlns:stk='http://schemas.microsoft.com/soap-toolkit/wsdl-extension'
    xmlns:dime='http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/'
    xmlns:ref='http://schemas.xmlsoap.org/ws/2002/04/reference/'
    xmlns:content='http://schemas.xmlsoap.org/ws/2002/04/content-type/'
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
    xmlns='http://schemas.xmlsoap.org/wsdl/'> <types>
    <schema
    targetNamespace='http://wynner/SCT/type/'
    xmlns='http://www.w3.org/2001/XMLSchema'
    xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
    elementFormDefault='qualified'> <import namespace='http://schemas.xmlsoap.org/soap/encoding/'/>
    <import namespace='http://schemas.xmlsoap.org/wsdl/'/>
    <import namespace='http://schemas.xmlsoap.org/ws/2002/04/reference/'/>
    <import namespace='http://schemas.xmlsoap.org/ws/2002/04/content-type/'/> </schema>
    </types> <message name='Speaker.GetMax'>
    <part name='a' type='xsd:int'/>
    <part name='b' type='xsd:int'/>
    </message> <message name='Speaker.GetMaxResponse'>
    <part name='rst' type='xsd:int'/>
    </message> <message name='Speaker.GetInput'>
    <part name='in' type='xsd:string'/>
    </message> <message name='Speaker.GetInputResponse'>
    <part name='out' type='xsd:string'/>
    </message> <portType name='SpeakerSoapPort'> <operation name='GetMax' parameterOrder='a b rst'>
    <input message='wsdlns:Speaker.GetMax'/>
    <output message='wsdlns:Speaker.GetMaxResponse'/>
    </operation> <operation name='GetInput' parameterOrder='in out'>
    <input message='wsdlns:Speaker.GetInput'/>
    <output message='wsdlns:Speaker.GetInputResponse'/>
    </operation> </portType> <binding name='SpeakerSoapBinding' type='wsdlns:SpeakerSoapPort' > <stk:binding preferredEncoding='UTF-8'/>
    <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='GetMax'>
    <soap:operation soapAction='http://wynner/SCT/action/Speaker.GetMax'/>
    <input>
    <soap:body
    use='encoded'
    namespace='http://wynner/SCT/message/'
    encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
    parts='a b'/>
    </input>
    <output>
    <soap:body
    use='encoded'
    namespace='http://wynner/SCT/message/'
    encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
    parts='rst'/>
    </output>
    </operation> <operation name='GetInput'>
    <soap:operation soapAction='http://wynner/SCT/action/Speaker.GetInput'/>
    <input>
    <soap:body
    use='encoded'
    namespace='http://wynner/SCT/message/'
    encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
    parts='in'/>
    </input>
    <output>
    <soap:body
    use='encoded'
    namespace='http://wynner/SCT/message/'
    encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
    parts='out'/>
    </output>
    </operation> </binding> <service name='SCT' >
    <port name='SpeakerSoapPort' binding='wsdlns:SpeakerSoapBinding' >
    <soap:address location='http://wynner/sct/SCT.WSDL'/>
    </port>
    </service></definitions>
      

  13.   

    返回的SOAP消息如下:
    很明显,调用成功了,但是就是取不到out的值HTTP/1.1 200 OKServer: Microsoft-IIS/5.0Date: Fri, 19 Sep 2003 01:02:31 GMTX-Powered-By: ASP.NETContent-Type: text/xml; charset="UTF-8"Content-Length: 367Expires: -1;<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAPSDK1:GetInputResponse xmlns:SOAPSDK1="http://wynner/SCT/message/"><out>abcdefg</out></SOAPSDK1:GetInputResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
      

  14.   

    另外,当
    http://expert.csdn.net/Expert/TopicView1.asp?id=2277435时也会出错
      

  15.   

    我试过了,应该没有问题,不过嘛,AXIS非常奇怪,当我的服务端没有返回值,也就是说我只有一个INOUT类型的参数而返回值是void的时候呢,确实通过call.getOutputParams();取不到,而通过call.invoke的返回值得到的,如果函数远程webservice的一个方法有多个返回值,也就是说有一个INOUT类型的参数,并且有返回值,或者有多于一个的INOUT类型的参数才能通过call.getOutputParams();得到.
      

  16.   

    给你我刚做的例子:
    WSDL如下:
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="http://generated.myservice.ws.bywang.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://generated.myservice.ws.bywang.com" xmlns:intf="http://generated.myservice.ws.bywang.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   <wsdl:message name="testStringHolderRequest">      <wsdl:part name="in0" type="xsd:string"/>      <wsdl:part name="in1" type="xsd:string"/>   </wsdl:message>   <wsdl:message name="testStringHolderResponse">      <wsdl:part name="testStringHolderReturn" type="xsd:string"/>      <wsdl:part name="in1" type="xsd:string"/>   </wsdl:message>   <wsdl:portType name="HolderTest">      <wsdl:operation name="testStringHolder" parameterOrder="in0 in1">         <wsdl:input message="impl:testStringHolderRequest" name="testStringHolderRequest"/>         <wsdl:output message="impl:testStringHolderResponse" name="testStringHolderResponse"/>      </wsdl:operation>   </wsdl:portType>   <wsdl:binding name="testStringHolderSoapBinding" type="impl:HolderTest">      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>      <wsdl:operation name="testStringHolder">         <wsdlsoap:operation soapAction=""/>         <wsdl:input name="testStringHolderRequest">            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://generated.myservice.ws.bywang.com" use="encoded"/>         </wsdl:input>         <wsdl:output name="testStringHolderResponse">            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://generated.myservice.ws.bywang.com" use="encoded"/>         </wsdl:output>      </wsdl:operation>   </wsdl:binding>   <wsdl:service name="HolderTestService">      <wsdl:port binding="impl:testStringHolderSoapBinding" name="testStringHolder">         <wsdlsoap:address location="http://localhost:8080/axis/services/testStringHolder"/>      </wsdl:port>   </wsdl:service></wsdl:definitions>
      

  17.   

    客户端代码如下:
    package com.bywang.app;import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import org.apache.axis.encoding.XMLType;
    import javax.xml.rpc.ParameterMode;
    import javax.xml.rpc.encoding.*;
    import javax.xml.namespace.QName;
    import java.util.*;
    import com.bywang.ws.holders.*;
    import org.apache.axis.*;
    import org.apache.axis.components.logger.LogFactory;
    import org.apache.axis.encoding.Base64;
    import org.apache.axis.handlers.BasicHandler;
    import org.apache.axis.transport.http.HTTPConstants;
    import org.apache.axis.utils.Messages;
    import org.apache.axis.message.*;
    //import javax.xml.soap.*;
    import java.util.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import org.apache.commons.logging.Log;/**
     * This class illustrates how to use the JAX-RPC API to invoke
     * the Order Processing Web service dynamically
     */
    public class testStringHolderClient {
      public static void main(String[] args) throws Exception {
      String targetNamespace = "http://generated.myservice.ws.bywang.com";
      Service service = new Service();  Call     call   = (Call) service.createCall();
      call.setTargetEndpointAddress("http://localhost:8080/axis/services/testStringHolder");
      QName qnstrIn=new QName(targetNamespace,"in0");
      QName qnstrInOut=new QName(targetNamespace,"in1");
      QName operationName = new QName(targetNamespace, "testStringHolder");  call.setOperationName(operationName);
      QName serviceName = new QName(targetNamespace,
                                    "testStringHolder");  call.addParameter("strh",serviceName,ParameterMode.INOUT);  call.setReturnType( XMLType.XSD_STRING );
      String test=new String("send a test string ");
      String inoutStr=new String("send a inout string");
      String str=(String)call.invoke( new Object[] {inoutStr} );
      System.out.println(str);
      Map outparams = call.getOutputParams();
      if (outparams!=null)
      {
         Iterator ite=outparams.values().iterator();
         if (ite.hasNext())
         {
            System.out.println((String)ite.next());
         }
      }
      }
    }
      

  18.   

    搞定乐!
    原来要把INOUT换成IN !!???
    简直是太莫名奇妙了!