asp 如何訪問java的短信接口
對方程序是java做的,提供了一個地址,還有用戶名,密碼 說往這裡傳參數就可以發短信,
我用ie直接訪問此地址,看到的是一個xml文件
asp這邊需要如何傳遞短信的一些參數還有用戶名密碼給對方呢
希望別貼教程,點撥一下最好,因為我從網上找了一些范例,但總是只返回狀態200 ok 沒有任何返回值,也沒有發送成短信,所以不知道為什麼了
用戶名密碼是用來識別是誰要調用此接口發短信
對方提供的url地址 http://10.13.255.196/SmsDownlinkReceive/services/DownlinkServiceImpl?wsdl
下面是用ie訪問這個地址後的xml文件
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://service.downlink.sms.mdcl.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://service.downlink.sms.mdcl.com" xmlns:intf="http://service.downlink.sms
.mdcl.com" xmlns:tns1="http:
//exception.downlink.sms.mdcl.com" xmlns:wsdl
="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xml
ns: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 elementFormDefault="qualified" targetNamespace="http://service.downlink.sms.mdcl.com" xmlns="http
://www.w3.org/2001/XMLSchema">
<import namespace="http://exception.downlink.sms.mdcl.com" />
<element name="getSmsStateById">
<complexType>
<sequence>
<element name="smsId" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="getSmsStateByIdResponse">
<complexType>
<sequence>
<element name="getSmsStateByIdReturn" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="fault" type="tns1:SmsException" />
<element name="sendSms">
<complexType>
<sequence>
<element name="userName" type="xsd:string" />
<element name="password" type="xsd:string" />
<element name="importance" type="xsd:int" />
<element name="mobile" type="xsd:string" />
<element name="smsBody" type="xsd:string" />
<element name="allowStartTime" type="xsd:int" />
<element name="allowEndTime" type="xsd:int" />
<element name="deadLineTime" type="xsd:dateTime" />
<element name="appointTime" type="xsd:dateTime" />
<element name="smsType" type="xsd:string" />
<element name="feeDept" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="sendSmsResponse">
<complexType>
<sequence>
<element name="sendSmsReturn" type="xsd:string" />
</sequence>
</complexType>
</element>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://exception.downlink.sms.mdcl.com" xmlns="h
ttp://www.w3.org/2001/XMLSchema">
<complexType name="SmsException">
<sequence>
<element name="errorMessage" nillable="true" type="xsd:string" />
<element name="errorCode" nillable="true" type="xsd:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="sendSmsResponse">
<wsdl:part element="intf:sendSmsResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="getSmsStateByIdResponse">
<wsdl:part element="intf:getSmsStateByIdResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="SmsException">
<wsdl:part element="intf:fault" name="fault" />
</wsdl:message>
<wsdl:message name="sendSmsRequest">
<wsdl:part element="intf:sendSms" name="parameters" />
</wsdl:message>
<wsdl:message name="getSmsStateByIdRequest">
<wsdl:part element="intf:getSmsStateById" name="parameters" />
</wsdl:message>
<wsdl:portType name="DownlinkServiceImpl">
<wsdl:operation name="getSmsStateById">
<wsdl:input message="intf:getSmsStateByIdRequest" name="getSmsStateByIdRequest" />
<wsdl:output message="intf:getSmsStateByIdResponse" name="getSmsStateByIdResponse" />
<wsdl:fault message="intf:SmsException" name="SmsException" />
</wsdl:operation>
<wsdl:operation name="sendSms">
<wsdl:input message="intf:sendSmsRequest" name="sendSmsRequest" />
<wsdl:output message="intf:sendSmsResponse" name="sendSmsResponse" /><wsdl:fault message="intf:SmsException" name="SmsException" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DownlinkServiceImplSoapBinding" type="intf:DownlinkServiceImpl">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getSmsStateById">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getSmsStateByIdRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="getSmsStateByIdResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
<wsdl:fault name="SmsException">
<wsdlsoap:fault name="SmsException" use="literal" />
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="sendSms">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="sendSmsRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="sendSmsResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
<wsdl:fault name="SmsException">
<wsdlsoap:fault name="SmsException" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DownlinkServiceImplService">
<wsdl:port binding="intf:DownlinkServiceImplSoapBinding" name="DownlinkServiceImpl">
<wsdlsoap:address location="http://10.13.255.196/SmsDownlinkReceive/services/DownlinkServiceImpl" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
------解決方案--------------------
1 裝一個 XMLSpy軟件,訪問所給的url地址,建一個ws soap請求(得到正確的請求格式), 看下正確的返回值格式
2 裝一個pocketsoap組件, 按上述請求格式構造請求, 按上述返回格式解析返回值