axis2动态调用c#的Webservice接口(急)

jiang521725 2011-08-12 12:12:24
webServiceURL:http://10.16.15.201:8899/EIACWeb_Business/Workflow/BizManagement/ServerPrefixServices.asmx?wsdl

wsdl的xml内容如下:
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm=" http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime=" http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns=" http://tempuri.org/" xmlns:s=" http://www.w3.org/2001/XMLSchema" xmlns:soap12=" http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http=" http://schemas.xmlsoap.org/wsdl/http/" targetNamespace=" http://tempuri.org/" xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace=" http://tempuri.org/">
- <s:element name="ReceiveGdCutoverBill">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="BillXml" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="ReceiveGdCutoverBillResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ReceiveGdCutoverBillResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
- <wsdl:message name="ReceiveGdCutoverBillSoapIn">
<wsdl:part name="parameters" element="tns:ReceiveGdCutoverBill" />
</wsdl:message>
- <wsdl:message name="ReceiveGdCutoverBillSoapOut">
<wsdl:part name="parameters" element="tns:ReceiveGdCutoverBillResponse" />
</wsdl:message>
- <wsdl:portType name="ServerPrefixServicesSoap">
- <wsdl:operation name="ReceiveGdCutoverBill">
<wsdl:documentation xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/">接单接口</wsdl:documentation>
<wsdl:input message="tns:ReceiveGdCutoverBillSoapIn" />
<wsdl:output message="tns:ReceiveGdCutoverBillSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="ServerPrefixServicesSoap" type="tns:ServerPrefixServicesSoap">
<soap:binding transport=" http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="ReceiveGdCutoverBill">
<soap:operation soapAction=" http://tempuri.org/ReceiveGdCutoverBill" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:binding name="ServerPrefixServicesSoap12" type="tns:ServerPrefixServicesSoap">
<soap12:binding transport=" http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="ReceiveGdCutoverBill">
<soap12:operation soapAction=" http://tempuri.org/ReceiveGdCutoverBill" style="document" />
- <wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="ServerPrefixServices">
- <wsdl:port name="ServerPrefixServicesSoap" binding="tns:ServerPrefixServicesSoap">
<soap:address location=" http://10.16.5.141:8899/EIACWeb_Business/Workflow/BizManagement/ServerPrefixServices.asmx" />
</wsdl:port>
- <wsdl:port name="ServerPrefixServicesSoap12" binding="tns:ServerPrefixServicesSoap12">
<soap12:address location=" http://10.16.5.141:8899/EIACWeb_Business/Workflow/BizManagement/ServerPrefixServices.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

我的调用方法如下:
Service service = new Service();
try{
Call call = (Call) service.createCall();
URL url = new URL(webServiceURL);
call.setTargetEndpointAddress(url);
//SOAPAction URL
call.setSOAPActionURI(" http://tempuri.org/");
//方法名
call.setOperationName(new QName(" http://tempuri.org/ReceiveGdCutoverBill","ReceiveGdCutoverBill"));
//传入的参数
call.addParameter(new QName(" http://tempuri.org/ReceiveGdCutoverBill","BillXml"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
//返回类型
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

call.setUseSOAPAction(true);
//设置传入的值
Object obj[] =new Object[]{paramNames};
//远程调用
resultObj=(String)call.invoke(obj);

}catch (Exception ex){....



异常:
{http://xml.apache.org/axis/}stackTrace:System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/.
...全文
157 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
softroad 2011-08-12
  • 打赏
  • 举报
回复
检查下发送xml文件。
luohuijun619 2011-08-12
  • 打赏
  • 举报
回复
axis2用得少,Lz可以试试用xfire,cxf,还有用SoapUI开下能不能通

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧