使用JAX-WS调用WebService的短信接口
发布时间:2020-12-17 00:39:47 所属栏目:安全 来源:网络整理
导读:1、首先这个接口的WSDL如下: ?xml version="1.0" encoding="UTF-8" ? - wsdl:definitions targetNamespace="http://短信服务器IP/qxt_jtd/service/SmsService" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://短信服务器IP/qxt_jtd
1、首先这个接口的WSDL如下: <?xml version="1.0" encoding="UTF-8" ?> - <wsdl:definitions targetNamespace="http://短信服务器IP/qxt_jtd/service/SmsService" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://短信服务器IP/qxt_jtd/service/SmsService" xmlns:intf="http://短信服务器IP/qxt_jtd/service/SmsService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://io.java" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <!-- WSDL created by Apache Axis version: 1.4 Built on Apr 22,2006 (06:55:48 PDT) --> - <wsdl:types> - <schema targetNamespace="http://短信服务器IP/qxt_jtd/service/SmsService" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://io.java" /> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> - <complexType name="ArrayOf_xsd_string"> - <complexContent> - <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" /> </restriction> </complexContent> </complexType> </schema> </wsdl:types> - <wsdl:message name="listSortedFilesResponse"> <wsdl:part name="listSortedFilesReturn" type="impl:ArrayOf_xsd_string" /> </wsdl:message> - <wsdl:message name="getMoResponse"> <wsdl:part name="getMoReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="smsFileNameRequest"> <wsdl:part name="tag" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getReportResponse1"> <wsdl:part name="getReportReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getBalanceResponse1"> <wsdl:part name="getBalanceReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="sendSmsRequest"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> <wsdl:part name="phone" type="xsd:string" /> <wsdl:part name="content" type="xsd:string" /> <wsdl:part name="gwid" type="xsd:string" /> </wsdl:message> - <wsdl:message name="sendSmsResponse"> <wsdl:part name="sendSmsReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getBalanceRequest"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> </wsdl:message> - <wsdl:message name="sendSmsRequest1"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> <wsdl:part name="gwid" type="xsd:string" /> <wsdl:part name="phone" type="xsd:string" /> <wsdl:part name="content" type="xsd:string" /> <wsdl:part name="npwd" type="xsd:string" /> <wsdl:part name="page" type="xsd:string" /> <wsdl:part name="cid" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getReportRequest"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getMoRequest1"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> <wsdl:part name="version" type="xsd:string" /> <wsdl:part name="number" type="xsd:string" /> <wsdl:part name="content" type="xsd:string" /> <wsdl:part name="npwd" type="xsd:string" /> <wsdl:part name="page" type="xsd:string" /> <wsdl:part name="cid" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getReportRequest1"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> <wsdl:part name="version" type="xsd:string" /> <wsdl:part name="number" type="xsd:string" /> <wsdl:part name="content" type="xsd:string" /> <wsdl:part name="npwd" type="xsd:string" /> <wsdl:part name="page" type="xsd:string" /> <wsdl:part name="cid" type="xsd:string" /> </wsdl:message> <wsdl:message name="mainResponse" /> - <wsdl:message name="mainRequest"> <wsdl:part name="s" type="impl:ArrayOf_xsd_string" /> </wsdl:message> - <wsdl:message name="sendMmsResponse"> <wsdl:part name="sendMmsReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getMoRequest"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getBalanceResponse"> <wsdl:part name="getBalanceReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="listSortedFilesRequest"> <wsdl:part name="dirFile" type="xsd:anyType" /> </wsdl:message> - <wsdl:message name="getReportResponse"> <wsdl:part name="getReportReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getMoResponse1"> <wsdl:part name="getMoReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="sendSmsResponse1"> <wsdl:part name="sendSmsReturn" type="xsd:string" /> </wsdl:message> - <wsdl:message name="getBalanceRequest1"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> <wsdl:part name="version" type="xsd:string" /> <wsdl:part name="number" type="xsd:string" /> <wsdl:part name="content" type="xsd:string" /> <wsdl:part name="npwd" type="xsd:string" /> <wsdl:part name="page" type="xsd:string" /> <wsdl:part name="cid" type="xsd:string" /> </wsdl:message> - <wsdl:message name="sendMmsRequest"> <wsdl:part name="username" type="xsd:string" /> <wsdl:part name="pwd" type="xsd:string" /> <wsdl:part name="phone" type="xsd:string" /> <wsdl:part name="title" type="xsd:string" /> <wsdl:part name="content" type="xsd:string" /> <wsdl:part name="gwid" type="xsd:string" /> </wsdl:message> - <wsdl:message name="smsFileNameResponse"> <wsdl:part name="smsFileNameReturn" type="xsd:string" /> </wsdl:message> - <wsdl:portType name="SmsService"> - <wsdl:operation name="main" parameterOrder="s"> <wsdl:input message="impl:mainRequest" name="mainRequest" /> <wsdl:output message="impl:mainResponse" name="mainResponse" /> </wsdl:operation> - <wsdl:operation name="getBalance" parameterOrder="username pwd"> <wsdl:input message="impl:getBalanceRequest" name="getBalanceRequest" /> <wsdl:output message="impl:getBalanceResponse" name="getBalanceResponse" /> </wsdl:operation> - <wsdl:operation name="getBalance" parameterOrder="username pwd version number content npwd page cid"> <wsdl:input message="impl:getBalanceRequest1" name="getBalanceRequest1" /> <wsdl:output message="impl:getBalanceResponse1" name="getBalanceResponse1" /> </wsdl:operation> - <wsdl:operation name="sendSms" parameterOrder="username pwd phone content gwid"> <wsdl:input message="impl:sendSmsRequest" name="sendSmsRequest" /> <wsdl:output message="impl:sendSmsResponse" name="sendSmsResponse" /> </wsdl:operation> - <wsdl:operation name="sendSms" parameterOrder="username pwd gwid phone content npwd page cid"> <wsdl:input message="impl:sendSmsRequest1" name="sendSmsRequest1" /> <wsdl:output message="impl:sendSmsResponse1" name="sendSmsResponse1" /> </wsdl:operation> - <wsdl:operation name="smsFileName" parameterOrder="tag"> <wsdl:input message="impl:smsFileNameRequest" name="smsFileNameRequest" /> <wsdl:output message="impl:smsFileNameResponse" name="smsFileNameResponse" /> </wsdl:operation> - <wsdl:operation name="sendMms" parameterOrder="username pwd phone title content gwid"> <wsdl:input message="impl:sendMmsRequest" name="sendMmsRequest" /> <wsdl:output message="impl:sendMmsResponse" name="sendMmsResponse" /> </wsdl:operation> - <wsdl:operation name="getReport" parameterOrder="username pwd"> <wsdl:input message="impl:getReportRequest" name="getReportRequest" /> <wsdl:output message="impl:getReportResponse" name="getReportResponse" /> </wsdl:operation> - <wsdl:operation name="getReport" parameterOrder="username pwd version number content npwd page cid"> <wsdl:input message="impl:getReportRequest1" name="getReportRequest1" /> <wsdl:output message="impl:getReportResponse1" name="getReportResponse1" /> </wsdl:operation> - <wsdl:operation name="listSortedFiles" parameterOrder="dirFile"> <wsdl:input message="impl:listSortedFilesRequest" name="listSortedFilesRequest" /> <wsdl:output message="impl:listSortedFilesResponse" name="listSortedFilesResponse" /> </wsdl:operation> - <wsdl:operation name="getMo" parameterOrder="username pwd"> <wsdl:input message="impl:getMoRequest" name="getMoRequest" /> <wsdl:output message="impl:getMoResponse" name="getMoResponse" /> </wsdl:operation> - <wsdl:operation name="getMo" parameterOrder="username pwd version number content npwd page cid"> <wsdl:input message="impl:getMoRequest1" name="getMoRequest1" /> <wsdl:output message="impl:getMoResponse1" name="getMoResponse1" /> </wsdl:operation> </wsdl:portType> - <wsdl:binding name="SmsServiceSoapBinding" type="impl:SmsService"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> - <wsdl:operation name="main"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="mainRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="mainResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getBalance"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getBalanceRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="getBalanceResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getBalance"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getBalanceRequest1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="getBalanceResponse1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="sendSms"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="sendSmsRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="sendSmsResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="sendSms"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="sendSmsRequest1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="sendSmsResponse1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="smsFileName"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="smsFileNameRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="smsFileNameResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="sendMms"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="sendMmsRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="sendMmsResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getReport"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getReportRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="getReportResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getReport"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getReportRequest1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="getReportResponse1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="listSortedFiles"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="listSortedFilesRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="listSortedFilesResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getMo"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getMoRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="getMoResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getMo"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="getMoRequest1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://util.sms.jtd.com" use="encoded" /> </wsdl:input> - <wsdl:output name="getMoResponse1"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://短信服务器IP/qxt_jtd/service/SmsService" use="encoded" /> </wsdl:output> </wsdl:operation> </wsdl:binding> - <wsdl:service name="SmsServiceService"> - <wsdl:port binding="impl:SmsServiceSoapBinding" name="SmsService"> <wsdlsoap:address location="http://短信服务器IP/qxt_jtd/service/SmsService" /> </wsdl:port> </wsdl:service> </wsdl:definitions> 2、其次我们来研究几个需要关注的信息: 目标命名空间[targetNamespace]:http://短信服务器IP/qxt_jtd/service/SmsService,你可以Ctrl+F在上面查找该属性的值 WebService服务的名字、端点名字、端点地址:让我们看下面这个节点: - <wsdl:service name="SmsServiceService"> - <wsdl:port binding="impl:SmsServiceSoapBinding" name="SmsService"> <wsdlsoap:address location="http://短信服务器IP/qxt_jtd/service/SmsService" /> </wsdl:port> </wsdl:service> 在上面的信息中: name="SmsServiceService"----------------->表示服务的名字 name="SmsService"------------------------>表示端点的名字 location="http://短信服务器IP/qxt_jtd/service/SmsService"---->表示端点的地址 3、这个端点下有哪些方法可以调用,方法的参数和返回值分别是什么呢,参考下面的节点信息: - <wsdl:portType name="SmsService"> - <wsdl:operation name="main" parameterOrder="s"> <wsdl:input message="impl:mainRequest" name="mainRequest" /> <wsdl:output message="impl:mainResponse" name="mainResponse" /> </wsdl:operation> - <wsdl:operation name="getBalance" parameterOrder="username pwd"> <wsdl:input message="impl:getBalanceRequest" name="getBalanceRequest" /> <wsdl:output message="impl:getBalanceResponse" name="getBalanceResponse" /> </wsdl:operation> - <wsdl:operation name="getBalance" parameterOrder="username pwd version number content npwd page cid"> <wsdl:input message="impl:getBalanceRequest1" name="getBalanceRequest1" /> <wsdl:output message="impl:getBalanceResponse1" name="getBalanceResponse1" /> </wsdl:operation> - <wsdl:operation name="sendSms" parameterOrder="username pwd phone content gwid"> <wsdl:input message="impl:sendSmsRequest" name="sendSmsRequest" /> <wsdl:output message="impl:sendSmsResponse" name="sendSmsResponse" /> </wsdl:operation> - <wsdl:operation name="sendSms" parameterOrder="username pwd gwid phone content npwd page cid"> <wsdl:input message="impl:sendSmsRequest1" name="sendSmsRequest1" /> <wsdl:output message="impl:sendSmsResponse1" name="sendSmsResponse1" /> </wsdl:operation> - <wsdl:operation name="smsFileName" parameterOrder="tag"> <wsdl:input message="impl:smsFileNameRequest" name="smsFileNameRequest" /> <wsdl:output message="impl:smsFileNameResponse" name="smsFileNameResponse" /> </wsdl:operation> - <wsdl:operation name="sendMms" parameterOrder="username pwd phone title content gwid"> <wsdl:input message="impl:sendMmsRequest" name="sendMmsRequest" /> <wsdl:output message="impl:sendMmsResponse" name="sendMmsResponse" /> </wsdl:operation> - <wsdl:operation name="getReport" parameterOrder="username pwd"> <wsdl:input message="impl:getReportRequest" name="getReportRequest" /> <wsdl:output message="impl:getReportResponse" name="getReportResponse" /> </wsdl:operation> - <wsdl:operation name="getReport" parameterOrder="username pwd version number content npwd page cid"> <wsdl:input message="impl:getReportRequest1" name="getReportRequest1" /> <wsdl:output message="impl:getReportResponse1" name="getReportResponse1" /> </wsdl:operation> - <wsdl:operation name="listSortedFiles" parameterOrder="dirFile"> <wsdl:input message="impl:listSortedFilesRequest" name="listSortedFilesRequest" /> <wsdl:output message="impl:listSortedFilesResponse" name="listSortedFilesResponse" /> </wsdl:operation> - <wsdl:operation name="getMo" parameterOrder="username pwd"> <wsdl:input message="impl:getMoRequest" name="getMoRequest" /> <wsdl:output message="impl:getMoResponse" name="getMoResponse" /> </wsdl:operation> - <wsdl:operation name="getMo" parameterOrder="username pwd version number content npwd page cid"> <wsdl:input message="impl:getMoRequest1" name="getMoRequest1" /> <wsdl:output message="impl:getMoResponse1" name="getMoResponse1" /> </wsdl:operation> </wsdl:portType> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |