13 个解决方案
#1
wsdl文件为如下。
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:intf="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:ASPSubNotifactionService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ASPSubNotificationRequest">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
<complexType name="ASPProvisionResultNotificationResponse">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn" type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType" type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
<wsdl:portType name="ASPSubNotificationRequestService">
<wsdl:operation name="ASPSubNotificationRequest" parameterOrder="requestType">
<wsdl:input message="impl:ASPSubNotificationRequestRequest" name="ASPSubNotificationRequestRequest" />
<wsdl:output message="impl:ASPSubNotificationRequestResponse" name="ASPSubNotificationRequestResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ASPSubNotifactionServiceSoapBinding" type="impl:ASPSubNotificationRequestService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ASPSubNotificationRequest">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="ASPSubNotificationRequestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ASPSubNotifactionService.service.services.webservices.esmp.ericsson.com" use="encoded" />
</wsdl:input>
<wsdl:output name="ASPSubNotificationRequestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ASPSubNotifactionServiceService">
<wsdl:port binding="impl:ASPSubNotifactionServiceSoapBinding" name="ASPSubNotifactionService">
<wsdlsoap:address location="http://esmp.enterprise.com//service/ASPSubNotifactionService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
在eclipse中显示
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn"
type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType"
type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
中的type类型不正确。
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:intf="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:ASPSubNotifactionService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ASPSubNotificationRequest">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
<complexType name="ASPProvisionResultNotificationResponse">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn" type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType" type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
<wsdl:portType name="ASPSubNotificationRequestService">
<wsdl:operation name="ASPSubNotificationRequest" parameterOrder="requestType">
<wsdl:input message="impl:ASPSubNotificationRequestRequest" name="ASPSubNotificationRequestRequest" />
<wsdl:output message="impl:ASPSubNotificationRequestResponse" name="ASPSubNotificationRequestResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ASPSubNotifactionServiceSoapBinding" type="impl:ASPSubNotificationRequestService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ASPSubNotificationRequest">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="ASPSubNotificationRequestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ASPSubNotifactionService.service.services.webservices.esmp.ericsson.com" use="encoded" />
</wsdl:input>
<wsdl:output name="ASPSubNotificationRequestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ASPSubNotifactionServiceService">
<wsdl:port binding="impl:ASPSubNotifactionServiceSoapBinding" name="ASPSubNotifactionService">
<wsdlsoap:address location="http://esmp.enterprise.com//service/ASPSubNotifactionService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
在eclipse中显示
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn"
type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType"
type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
中的type类型不正确。
#2
>>如何通过wsdl2java 生成服务器端代码
没用过,帮你顶一下
没用过,帮你顶一下
#3
按有几个群,你不妨加进去,可以和大家一起讨论啊.........46986340,28039577,4804620
在那里看看有无能回答你的,谢谢,LZ,甭忘了给俺分哦,谢谢LZ
在那里看看有无能回答你的,谢谢,LZ,甭忘了给俺分哦,谢谢LZ
#4
帮顶!
#5
学习
#6
什么叫wsdl文件,是用什么工具生成的,作用是什么?能解释一下吗?谢谢LZ
#7
这个应该算soap的一项应该吧?我也不是很熟,以前参照一个BLOG做过一个小的测试:http://blog.csdn.net/yown/archive/2006/07/03/869523.aspx
你可以看看
接口调用方法(java实现)
假设提供soap接口的服务端地址为” http://192.168.13.1:8088/test”
访问WEB地址” http://10.0.0.100:8088/test?wsdl”获得wsdl文档
假定文档中说明该调用接口的类方法String do(String msg)
try {
String endpoint = " http://192.168.13.1:8088/test";
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = null;
call = (org.apache.axis.client.Call) service.createCall();
call.setOperationName(new javax.xml.namespace.QName(endpoint,"do"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
String msg = “testParameter”;
String ret = (String)call.invoke(new Object[]{msg});
}
catch (ServiceException ex)
{
ex.printStackTrace();
}
你可以看看
接口调用方法(java实现)
假设提供soap接口的服务端地址为” http://192.168.13.1:8088/test”
访问WEB地址” http://10.0.0.100:8088/test?wsdl”获得wsdl文档
假定文档中说明该调用接口的类方法String do(String msg)
try {
String endpoint = " http://192.168.13.1:8088/test";
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = null;
call = (org.apache.axis.client.Call) service.createCall();
call.setOperationName(new javax.xml.namespace.QName(endpoint,"do"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
String msg = “testParameter”;
String ret = (String)call.invoke(new Object[]{msg});
}
catch (ServiceException ex)
{
ex.printStackTrace();
}
#8
把wsdl转换成java有很多工具
比如axis的WSDL2JAVA类就可以,
java -cp axis.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;jaxrpc.jar;log4j-1.2.8.jar;saaj.jar;wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java 你要转换的WSDL.wsdl
如果直接使用上边的命令的话,依赖文件必须和wsdl文件在同一个目录下
比如axis的WSDL2JAVA类就可以,
java -cp axis.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;jaxrpc.jar;log4j-1.2.8.jar;saaj.jar;wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java 你要转换的WSDL.wsdl
如果直接使用上边的命令的话,依赖文件必须和wsdl文件在同一个目录下
#9
LS说的不错。如果你用eclipse开发的话,可以试试Axis2 Code Generator插件,使用非常方便。
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-codegen-wizard.zip
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-codegen-wizard.zip
#10
配合上面的插件还有一个比较好用的是Axis2 Service Archiver,可以将普通的.java文件打包成.aar文件,然后就可以发布成webservice了。
如果不知道如何安装和使用,去google搜一下axis2 webservice就能找到很多教程了。
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-service-archiver-wizard.zip
如果不知道如何安装和使用,去google搜一下axis2 webservice就能找到很多教程了。
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-service-archiver-wizard.zip
#11
#12
是不是接口代码都是WSDL的后缀文件啊??
#13
楼主,你好,请问你这个问题最后解决了吗,怎么解决的,我也是需要根据别人的.wsdl文件写一个接口给别人调用,别人提供的wsdl文件中的<soap:operation soapAction="WorkOrder" style="rpc"/>
style为rpc,导致不能生成代码
Exception occurred during code generation for the WSDL : org.apache.axis2.AxisFault: The binding operation processIVRBusi is RPC/literal. The message parts for this operation must use the type attribute as specificed by WS-I Basic Profile specification (4.4.1). Message part, TradeRequestMessage, violatesthis rule. Please remove the element attribute and use the type attribute.
泣血跪求答案,感激不尽
我的QQ:277574404
style为rpc,导致不能生成代码
Exception occurred during code generation for the WSDL : org.apache.axis2.AxisFault: The binding operation processIVRBusi is RPC/literal. The message parts for this operation must use the type attribute as specificed by WS-I Basic Profile specification (4.4.1). Message part, TradeRequestMessage, violatesthis rule. Please remove the element attribute and use the type attribute.
泣血跪求答案,感激不尽
我的QQ:277574404
#1
wsdl文件为如下。
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:intf="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:ASPSubNotifactionService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ASPSubNotificationRequest">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
<complexType name="ASPProvisionResultNotificationResponse">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn" type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType" type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
<wsdl:portType name="ASPSubNotificationRequestService">
<wsdl:operation name="ASPSubNotificationRequest" parameterOrder="requestType">
<wsdl:input message="impl:ASPSubNotificationRequestRequest" name="ASPSubNotificationRequestRequest" />
<wsdl:output message="impl:ASPSubNotificationRequestResponse" name="ASPSubNotificationRequestResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ASPSubNotifactionServiceSoapBinding" type="impl:ASPSubNotificationRequestService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ASPSubNotificationRequest">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="ASPSubNotificationRequestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ASPSubNotifactionService.service.services.webservices.esmp.ericsson.com" use="encoded" />
</wsdl:input>
<wsdl:output name="ASPSubNotificationRequestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ASPSubNotifactionServiceService">
<wsdl:port binding="impl:ASPSubNotifactionServiceSoapBinding" name="ASPSubNotifactionService">
<wsdlsoap:address location="http://esmp.enterprise.com//service/ASPSubNotifactionService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
在eclipse中显示
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn"
type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType"
type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
中的type类型不正确。
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:intf="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:ASPSubNotifactionService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ASPSubNotificationRequest">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
<complexType name="ASPProvisionResultNotificationResponse">
<sequence>
<element name="aspID" type="soapenc:string" />
<element name="sentTime" type="soapenc:string" />
<element name="transactionID" type="soapenc:string" />
<element name="subscriptionID" nillable="true" type="soapenc:string" />
<element name="resultCode" type="xsd:int" />
<element name="resultMessage" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn" type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType" type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
<wsdl:portType name="ASPSubNotificationRequestService">
<wsdl:operation name="ASPSubNotificationRequest" parameterOrder="requestType">
<wsdl:input message="impl:ASPSubNotificationRequestRequest" name="ASPSubNotificationRequestRequest" />
<wsdl:output message="impl:ASPSubNotificationRequestResponse" name="ASPSubNotificationRequestResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ASPSubNotifactionServiceSoapBinding" type="impl:ASPSubNotificationRequestService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ASPSubNotificationRequest">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="ASPSubNotificationRequestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ASPSubNotifactionService.service.services.webservices.esmp.ericsson.com" use="encoded" />
</wsdl:input>
<wsdl:output name="ASPSubNotificationRequestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://esmp.enterprise.com/service/ASPSubNotifactionService" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ASPSubNotifactionServiceService">
<wsdl:port binding="impl:ASPSubNotifactionServiceSoapBinding" name="ASPSubNotifactionService">
<wsdlsoap:address location="http://esmp.enterprise.com//service/ASPSubNotifactionService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
在eclipse中显示
<wsdl:message name="ASPSubNotificationRequestResponse">
<wsdl:part name="ASPSubNotificationRequestReturn"
type="tns1:ASPProvisionResultNotificationResponse" />
</wsdl:message>
<wsdl:message name="ASPSubNotificationRequestRequest">
<wsdl:part name="requestType"
type="tns1:ASPSubNotificationRequest" />
</wsdl:message>
中的type类型不正确。
#2
>>如何通过wsdl2java 生成服务器端代码
没用过,帮你顶一下
没用过,帮你顶一下
#3
按有几个群,你不妨加进去,可以和大家一起讨论啊.........46986340,28039577,4804620
在那里看看有无能回答你的,谢谢,LZ,甭忘了给俺分哦,谢谢LZ
在那里看看有无能回答你的,谢谢,LZ,甭忘了给俺分哦,谢谢LZ
#4
帮顶!
#5
学习
#6
什么叫wsdl文件,是用什么工具生成的,作用是什么?能解释一下吗?谢谢LZ
#7
这个应该算soap的一项应该吧?我也不是很熟,以前参照一个BLOG做过一个小的测试:http://blog.csdn.net/yown/archive/2006/07/03/869523.aspx
你可以看看
接口调用方法(java实现)
假设提供soap接口的服务端地址为” http://192.168.13.1:8088/test”
访问WEB地址” http://10.0.0.100:8088/test?wsdl”获得wsdl文档
假定文档中说明该调用接口的类方法String do(String msg)
try {
String endpoint = " http://192.168.13.1:8088/test";
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = null;
call = (org.apache.axis.client.Call) service.createCall();
call.setOperationName(new javax.xml.namespace.QName(endpoint,"do"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
String msg = “testParameter”;
String ret = (String)call.invoke(new Object[]{msg});
}
catch (ServiceException ex)
{
ex.printStackTrace();
}
你可以看看
接口调用方法(java实现)
假设提供soap接口的服务端地址为” http://192.168.13.1:8088/test”
访问WEB地址” http://10.0.0.100:8088/test?wsdl”获得wsdl文档
假定文档中说明该调用接口的类方法String do(String msg)
try {
String endpoint = " http://192.168.13.1:8088/test";
org.apache.axis.client.Service service = new org.apache.axis.client.Service();
org.apache.axis.client.Call call = null;
call = (org.apache.axis.client.Call) service.createCall();
call.setOperationName(new javax.xml.namespace.QName(endpoint,"do"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
String msg = “testParameter”;
String ret = (String)call.invoke(new Object[]{msg});
}
catch (ServiceException ex)
{
ex.printStackTrace();
}
#8
把wsdl转换成java有很多工具
比如axis的WSDL2JAVA类就可以,
java -cp axis.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;jaxrpc.jar;log4j-1.2.8.jar;saaj.jar;wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java 你要转换的WSDL.wsdl
如果直接使用上边的命令的话,依赖文件必须和wsdl文件在同一个目录下
比如axis的WSDL2JAVA类就可以,
java -cp axis.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;jaxrpc.jar;log4j-1.2.8.jar;saaj.jar;wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java 你要转换的WSDL.wsdl
如果直接使用上边的命令的话,依赖文件必须和wsdl文件在同一个目录下
#9
LS说的不错。如果你用eclipse开发的话,可以试试Axis2 Code Generator插件,使用非常方便。
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-codegen-wizard.zip
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-codegen-wizard.zip
#10
配合上面的插件还有一个比较好用的是Axis2 Service Archiver,可以将普通的.java文件打包成.aar文件,然后就可以发布成webservice了。
如果不知道如何安装和使用,去google搜一下axis2 webservice就能找到很多教程了。
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-service-archiver-wizard.zip
如果不知道如何安装和使用,去google搜一下axis2 webservice就能找到很多教程了。
下载地址:http://mirror.x10.com/mirror/apache/ws/axis2/tools/1_3/axis2-eclipse-service-archiver-wizard.zip
#11
#12
是不是接口代码都是WSDL的后缀文件啊??
#13
楼主,你好,请问你这个问题最后解决了吗,怎么解决的,我也是需要根据别人的.wsdl文件写一个接口给别人调用,别人提供的wsdl文件中的<soap:operation soapAction="WorkOrder" style="rpc"/>
style为rpc,导致不能生成代码
Exception occurred during code generation for the WSDL : org.apache.axis2.AxisFault: The binding operation processIVRBusi is RPC/literal. The message parts for this operation must use the type attribute as specificed by WS-I Basic Profile specification (4.4.1). Message part, TradeRequestMessage, violatesthis rule. Please remove the element attribute and use the type attribute.
泣血跪求答案,感激不尽
我的QQ:277574404
style为rpc,导致不能生成代码
Exception occurred during code generation for the WSDL : org.apache.axis2.AxisFault: The binding operation processIVRBusi is RPC/literal. The message parts for this operation must use the type attribute as specificed by WS-I Basic Profile specification (4.4.1). Message part, TradeRequestMessage, violatesthis rule. Please remove the element attribute and use the type attribute.
泣血跪求答案,感激不尽
我的QQ:277574404