2. 安装soapUI。
3. 打开soapUI,进入如下界面
4. 选择 File选项---》New soapUI Project 将会弹出如下界面
直接默认选项即可,soapUI默认创建webservice客户端。
5. 单击Browse… 按钮选择需要导入的wsdl文件,本次模拟积分商城客户端,wsdl文件为CRM-DEP.wsdl,选择后如下图所示:
Project Name根据情况进行修改,默认为wsdl文件前缀。其他选项本次默认即可。然后点击OK即可。则soapUI会创建一个新的工程,如下所示:
6. 双击CRM-DEP工程---》DEPServiceHttpBinding –》exchange ---》Request 1 弹出Request 1的窗口如下:
7. 单击按钮,然后单击最大化按钮,soapUI视图如下:
8. 修改服务请求地址:单击,选择add new endpoint… 选项进行请求地址新增:将要访问的url地址写入编辑框内,然后点击确定即可。
9. 修改请求内容。直接修改左侧请求报文中的in0 参数内容,默认为?,修改为积分商城请求包内容, 因为in0中需要填写整个xml包内容,所以需要将发送报文写入标签<![CDATA[]]>中。格式为:<![CDATA[xml包体]]> xml包体填写需要发送的xml包内容。
如发送积分归集请求,则修改后的请求报文内容为:
<soapenv:Envelope xmlns:soapenv="/soap/envelope/" xmlns:chin="www.chinatelecom.hub">
<soapenv:Header/>
<soapenv:Body>
<chin:exchange>
<chin:in0><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<ContractRoot>
<TcpCont>
<BusCode>BUS17002</BusCode>
<ServiceCode>SVC17004</ServiceCode>
<ServiceContractVer>SVC1700220091002</ServiceContractVer>
<ActionCode>0</ActionCode>
<TransactionID>1000000001200905201531030049</TransactionID>
<ServiceLevel>1</ServiceLevel>
<SrcOrgID>100000</SrcOrgID>
<SrcSysID>1000000001</SrcSysID>
<SrcSysSign>123</SrcSysSign>
<DstOrgID>600203</DstOrgID>
<DstSysID>6002030001</DstSysID>
<ReqTime>20090811121212</ReqTime>
</TcpCont>
<SvcCont>
<PointMerge>
<ProvinceCode>091212</ProvinceCode>
<DistrictCode>1234</DistrictCode>
<SumTime>20110101000000</SumTime>
<PropertyInfo>
<ItemID>1</ItemID>
<ItemName>?</ItemName>
<ItemValue>1</ItemValue>
<ItemValueName>?</ItemValueName>
</PropertyInfo>
<CustPointInfo>
<CustName>?</CustName>
<IndentifyInfo>
<IdentType>2</IdentType>
<IdentNum>123456</IdentNum>
</IndentifyInfo>
<PointAmount>500</PointAmount>
<PointStatus>1</PointStatus>
成都铁路局公告 <PointType></PointType>
<Desttime>20310101000000</Desttime>
<PropertyInfo>
<ItemID>1</ItemID>
<ItemName>?</ItemName>
<ItemValue>1</ItemValue>
<ItemValueName>?</ItemValueName>
</PropertyInfo>
</CustPointInfo>
</PointMerge>
</SvcCont>
</ContractRoot>]]>
</chin:in0>
</chin:exchange>
</soapenv:Body>
</soapenv:Envelope>
单击Request 1窗口做上方按钮,即可进行webservice请求发送。如果请求成功,则返回包内容将会显示到右侧窗口中。如上请求返回的内容为:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="/soap/envelope/" xmlns:SOAP-ENC="/soap/encoding/" xmlns:xsi="www.w3.
org/2001/XMLSchema-instance" xmlns:xsd="/2001/XMLSchema" xmlns:ns1="www.chinatelecom.hub">
发布评论