SoapUI5.0创建WebService接口模拟服务端
2016-08-23 19:36
537 查看
使用SoapUI创建WebService接口模拟服务端需要接口描述文件
MathUtil.wsdl:
[plain]
view plain
copy
print?
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://sean.com"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://sean.com"
xmlns:intf="http://sean.com"
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 elementFormDefault="qualified"
targetNamespace="http://sean.com"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="add">
<complexType>
<sequence>
<element name="x" type="xsd:int"/>
<element name="y" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="addResponse">
<complexType>
<sequence>
<element name="addReturn" type="xsd:int"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="addResponse">
<wsdl:part element="impl:addResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addRequest">
<wsdl:part element="impl:add" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="MathUtil">
<wsdl:operation name="add">
<wsdl:input message="impl:addRequest" name="addRequest">
</wsdl:input>
<wsdl:output message="impl:addResponse" name="addResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MathUtilSoapBinding" type="impl:MathUtil">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="add">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MathUtilService">
<wsdl:port binding="impl:MathUtilSoapBinding" name="MathUtil">
<wsdlsoap:address
location="http://localhost:8080/webservice_create/services/MathUtil"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
通过MathUtil.wsdl文件在SoapUI中创建一个SOAP项目:
确认后,会在新建的SOAP项目下自动生成模拟客户端
在模拟客户端的基础上创建一个接口模拟服务端(Mock Service):
双击Response1可以设置接口服务端返回值:
返回值默认为"?",一定要进行修改,否则调用该接口时会报错
[plain]
view plain
copy
print?
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.NumberFormatException: For input string: "?"
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException: For input string: "?"
双击创建的接口模拟服务端:
修改接口模拟服务端配置:
配置完成后,启动模拟服务端:
此时模拟服务端已经启动,可以使用了:
http://blog.csdn.net/a19881029/article/details/26348627
使用SoapUI创建WebService接口模拟服务端需要接口描述文件
MathUtil.wsdl:
[plain]
view plain
copy
print?
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://sean.com"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://sean.com"
xmlns:intf="http://sean.com"
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 elementFormDefault="qualified"
targetNamespace="http://sean.com"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="add">
<complexType>
<sequence>
<element name="x" type="xsd:int"/>
<element name="y" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="addResponse">
<complexType>
<sequence>
<element name="addReturn" type="xsd:int"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="addResponse">
<wsdl:part element="impl:addResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addRequest">
<wsdl:part element="impl:add" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="MathUtil">
<wsdl:operation name="add">
<wsdl:input message="impl:addRequest" name="addRequest">
</wsdl:input>
<wsdl:output message="impl:addResponse" name="addResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MathUtilSoapBinding" type="impl:MathUtil">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="add">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MathUtilService">
<wsdl:port binding="impl:MathUtilSoapBinding" name="MathUtil">
<wsdlsoap:address
location="http://localhost:8080/webservice_create/services/MathUtil"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://sean.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://sean.com" xmlns:intf="http://sean.com" 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 elementFormDefault="qualified" targetNamespace="http://sean.com" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="add"> <complexType> <sequence> <element name="x" type="xsd:int"/> <element name="y" type="xsd:int"/> </sequence> </complexType> </element> <element name="addResponse"> <complexType> <sequence> <element name="addReturn" type="xsd:int"/> </sequence> </complexType> </element> </schema> </wsdl:types> <wsdl:message name="addResponse"> <wsdl:part element="impl:addResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="addRequest"> <wsdl:part element="impl:add" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="MathUtil"> <wsdl:operation name="add"> <wsdl:input message="impl:addRequest" name="addRequest"> </wsdl:input> <wsdl:output message="impl:addResponse" name="addResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="MathUtilSoapBinding" type="impl:MathUtil"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="add"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="addRequest"> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="addResponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="MathUtilService"> <wsdl:port binding="impl:MathUtilSoapBinding" name="MathUtil"> <wsdlsoap:address location="http://localhost:8080/webservice_create/services/MathUtil"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
通过MathUtil.wsdl文件在SoapUI中创建一个SOAP项目:
确认后,会在新建的SOAP项目下自动生成模拟客户端
在模拟客户端的基础上创建一个接口模拟服务端(Mock Service):
双击Response1可以设置接口服务端返回值:
返回值默认为"?",一定要进行修改,否则调用该接口时会报错
[plain]
view plain
copy
print?
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.NumberFormatException: For input string: "?"
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException: For input string: "?"
AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.NumberFormatException: For input string: "?" faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException: For input string: "?"
双击创建的接口模拟服务端:
修改接口模拟服务端配置:
配置完成后,启动模拟服务端:
此时模拟服务端已经启动,可以使用了:
http://blog.csdn.net/a19881029/article/details/26348627
相关文章推荐
- SoapUI5.0创建WebService接口模拟服务端
- 【转】SoapUI5.0创建WebService接口模拟服务端
- soapUI4.5模拟客户端测试webservice接口,含性能测试
- 如何利用soapUI建soap接口的服务端模拟桩
- 使用CXF创建webService服务端
- CXF创建webservice客户端和服务端
- Webservice_17_客户端创建Handler,服务端接受Handler
- 【Java通过Cxf创建webService接口】
- webService为其它程序提供接口示例,创建wsdl文件
- 如何在Dynamic CRM 2013中创建WebService接口供其它系统调用
- Android客户端WebService访问接口(Ksoap2Android调用.net服务端)
- CXF创建webservice客户端和服务端
- WebService——CXF方式创建WebService服务端
- Java创建WebService服务端及客户端
- Axis创建webservice客户端和服务端
- CXF创建webservice服务端、客户端,与spring集成
- 创建基于JAX-WS的WebService的服务端及客户端
- 使用JAX-WS创建webservice服务,含服务端及客户端
- 求助:用WebService写一个服务端的接口
- php中创建和调用webservice接口示例