以文本方式查看主题

-  W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL  (http://bbs.xml.org.cn/index.asp)
--  『 Web Services & Semantic Web Services 』  (http://bbs.xml.org.cn/list.asp?boardid=10)
----  [求助]急!!!!!eclipse下调用axis2开发的webservice参数传递为空  (http://bbs.xml.org.cn/dispbbs.asp?boardid=10&rootid=&id=122426)


--  作者:sunny_boy50001
--  发布时间:11/9/2011 6:50:00 PM

--  [求助]急!!!!!eclipse下调用axis2开发的webservice参数传递为空
服务端
public class sendCommon {
 public Boolean sendCommonBillData(String username,String password,String billStr)
 {
  System.out.println(username+ password+billStr);
  return true;
 
 }
}
生成的wsdl文件
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-. -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://send_DR/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="sendCommonService" targetNamespace="http://send_DR/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://send_DR/" schemaLocation="SendCommonService_schema1.xsd"/>
    </xsd:schema>
  </types>
  <message name="sendCommonBillData">
    <part element="tns:sendCommonBillData" name="parameters"/>
  </message>
  <message name="sendCommonBillDataResponse">
    <part element="tns:sendCommonBillDataResponse" name="parameters"/>
  </message>
  <portType name="sendCommonDelegate">
    <operation name="sendCommonBillData">
      <input message="tns:sendCommonBillData"/>
      <output message="tns:sendCommonBillDataResponse"/>
    </operation>
  </portType>
  <binding name="sendCommonPortBinding" type="tns:sendCommonDelegate">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="sendCommonBillData">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="sendCommonService">
    <port binding="tns:sendCommonPortBinding" name="sendCommonPort">
      <soap:address location="http://localhost:8080/sendCommonBillData/sendCommonService"/>
    </port>
  </service>
</definitions>
生成的xsd文件
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://send_DR/" targetNamespace="http://send_DR/" version="1.0">

  <xs:element name="sendCommonBillData" type="tns:sendCommonBillData"/>

  <xs:element name="sendCommonBillDataResponse" type="tns:sendCommonBillDataResponse"/>

  <xs:complexType name="sendCommonBillData">
    <xs:sequence>
      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
      <xs:element minOccurs="0" name="arg1" type="xs:string"/>
      <xs:element minOccurs="0" name="arg2" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="sendCommonBillDataResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="return" type="xs:boolean"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
访问端-调用方法
Service service = new Service();
Call call = (Call)service.createCall();
String endpoint = "http://192.168.248.102:8080/sendCommonBillData/sendCommonPort?WSDL";
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://send_DR/", "sendCommonBillData"));
call.addParameter(new QName("http://send_DR/","username"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("http://send_DR/","passsword"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("http://send_DR/","billStr"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
              
call.setUseSOAPAction(true);
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_BOOLEAN);
boolean ret = false;
ret =(Boolean) call.invoke(new Object[]{username,password,billStr});

结果 nullnullnull


--  作者:sunny_boy50001
--  发布时间:11/9/2011 9:04:00 PM

--  
call.addParameter(new QName("http://send_DR/","arg0"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
这样也不对,有人知道这个地方要怎么写或者怎么改么?
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms