重新生成WSDL,然后重新从WSDL编译类,试试。

解决方案 »

  1.   

    下面是wsdl文件内容:
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <s0:definitions name="MaintainAccountServiceServiceDefinitions" targetNamespace="http://services" xmlns="" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://services" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/">
    - <s0:types>
    - <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://services" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://services" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    - <xs:element name="operateAccount">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="sysid" type="xs:string" /> 
      <xs:element name="userid" type="xs:string" /> 
      <xs:element name="appuserid" type="xs:string" /> 
      <xs:element name="pwd" type="xs:string" /> 
      <xs:element name="cmd" type="xs:string" /> 
      </xs:sequence>
      </xs:complexType>
      </xs:element>
    - <xs:element name="operateAccountResponse">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="return" type="xs:string" /> 
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>
      </s0:types>
    - <s0:message name="operateAccount">
      <s0:part element="s1:operateAccount" name="parameters" /> 
      </s0:message>
    - <s0:message name="operateAccountResponse">
      <s0:part element="s1:operateAccountResponse" name="parameters" /> 
      </s0:message>
    - <s0:portType name="MaintainAccountService">
    - <s0:operation name="operateAccount" parameterOrder="parameters">
      <s0:input message="s1:operateAccount" /> 
      <s0:output message="s1:operateAccountResponse" /> 
      </s0:operation>
      </s0:portType>
    - <s0:binding name="MaintainAccountServiceServiceSoapBinding" type="s1:MaintainAccountService">
      <s2:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
    - <s0:operation name="operateAccount">
      <s2:operation soapAction="" style="document" /> 
    - <s0:input>
      <s2:body parts="parameters" use="literal" /> 
      </s0:input>
    - <s0:output>
      <s2:body parts="parameters" use="literal" /> 
      </s0:output>
      </s0:operation>
      </s0:binding>
    - <s0:service name="MaintainAccountServiceService">
    - <s0:port binding="s1:MaintainAccountServiceServiceSoapBinding" name="MaintainAccountServiceSoapPort">
      <s2:address location="http://localhost:7001/ServiceWeb/MaintainAccountService" /> 
      </s0:port>
      </s0:service>
      </s0:definitions
      

  2.   


    我的客户端调用程序片段:
    ....
    public static void main(String[] args) throws Exception {
    String endPoint = "http://localhost:7001/ServiceWeb/MaintainAccountService";
    Service service = new Service();
    Call cal = (Call) service.createCall();
    cal.setTargetEndpointAddress(new URL(endPoint));

    cal.setReturnType(XMLType.XSD_STRING);
    cal.addParameter( new QName("http://www.openuri.org/","sysid"),XMLType.XSD_STRING,ParameterMode.IN );
    cal.addParameter( new QName("http://www.openuri.org/","userid"),XMLType.XSD_STRING,ParameterMode.IN );
    cal.addParameter( new QName("http://www.openuri.org/","appuserid"),XMLType.XSD_STRING,ParameterMode.IN );
    cal.addParameter( new QName("http://www.openuri.org/","pwd"),XMLType.XSD_STRING,ParameterMode.IN );
    cal.addParameter( new QName("http://www.openuri.org/","cmd"),XMLType.XSD_STRING,ParameterMode.IN );
    String sysid = "11",userid = "test2",appuserid = "zhaohh",pwd = "1111111",cmd = "add";
    cal.setOperationName("operateAccount");
    String res = (String) cal.invoke( new Object[] {sysid,userid,appuserid,pwd,cmd} );
    System.out.println("ssl="+res);}
    .....
      

  3.   

    重新生成WSDL,然后重新从WSDL编译类,试试。
      

  4.   

    cal.setOperationName("operateAccount");这句写的有问题,你写成下面这个试一下:
    cal.setOperationName(new QName("http://services","operateAccount"));