リクエストを Web サービスに送信できません。
文字列配列が受け入れられず、エラーが表示されます。
SOAP リクエストで配列文字列を送信したいのですが、エラーが表示されます。
私のウェブサービス:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:typens="urn:HostIranSmsWebService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="HostIranSmsWebService" targetNamespace="urn:HostIranSmsWebService">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:HostIranSmsWebService">
<xsd:complexType name="ArrayOfstring">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ArrayOfint">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="AccountInfo">
<xsd:all>
<xsd:element name="numbers" type="typens:ArrayOfstring"/>
<xsd:element name="defaultNumber" type="xsd:string"/>
<xsd:element name="receiveUrl" type="xsd:string"/>
<xsd:element name="sent" type="xsd:int"/>
<xsd:element name="received" type="xsd:int"/>
<xsd:element name="credit" type="xsd:int"/>
<xsd:element name="remaining" type="xsd:int"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<message name="send">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="to" type="xsd:string"/>
<part name="msg" type="xsd:string"/>
<part name="from" type="xsd:string"/>
<part name="time" type="xsd:int"/>
</message>
<message name="sendResponse">
<part name="sendResponse" type="xsd:int"/>
</message>
<message name="sendToMany">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="to" type="typens:ArrayOfstring"/>
<part name="msg" type="xsd:string"/>
<part name="from" type="xsd:string"/>
<part name="time" type="xsd:int"/>
</message>
<message name="sendToManyResponse">
<part name="sendToManyResponse" type="typens:ArrayOfint"/>
</message>
<message name="deliveryStatus">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="recipientId" type="xsd:int"/>
</message>
<message name="deliveryStatusResponse">
<part name="deliveryStatusResponse" type="xsd:int"/>
</message>
<message name="verifyReceive">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="ticket" type="xsd:string"/>
</message>
<message name="verifyReceiveResponse">
<part name="verifyReceiveResponse" type="xsd:boolean"/>
</message>
<message name="accountInfo">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="accountInfoResponse">
<part name="accountInfoResponse" type="typens:AccountInfo"/>
</message>
<message name="changePassword">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="newPassword" type="xsd:string"/>
</message>
<message name="changePasswordResponse">
<part name="changePasswordResponse" type="xsd:void"/>
</message>
<message name="changeTrafficRelay">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="newURL" type="xsd:string"/>
</message>
<message name="changeTrafficRelayResponse">
<part name="changeTrafficRelayResponse" type="xsd:void"/>
</message>
<portType name="HostIranSmsWebServicePort">
<operation name="send">
<documentation>Send one SMS.</documentation>
<input message="typens:send"/>
<output message="typens:sendResponse"/>
</operation>
<operation name="sendToMany">
<documentation>Send one SMS to many.</documentation>
<input message="typens:sendToMany"/>
<output message="typens:sendToManyResponse"/>
</operation>
<operation name="deliveryStatus">
<documentation>Check SMS delivery status.</documentation>
<input message="typens:deliveryStatus"/>
<output message="typens:deliveryStatusResponse"/>
</operation>
<operation name="verifyReceive">
<documentation>Verify sms validity when you receive an sms</documentation>
<input message="typens:verifyReceive"/>
<output message="typens:verifyReceiveResponse"/>
</operation>
<operation name="accountInfo">
<documentation>Get account info.</documentation>
<input message="typens:accountInfo"/>
<output message="typens:accountInfoResponse"/>
</operation>
<operation name="changePassword">
<documentation>Change account password.</documentation>
<input message="typens:changePassword"/>
<output message="typens:changePasswordResponse"/>
</operation>
<operation name="changeTrafficRelay">
<documentation>Change traffic relay.</documentation>
<input message="typens:changeTrafficRelay"/>
<output message="typens:changeTrafficRelayResponse"/>
</operation>
</portType>
<binding name="HostIranSmsWebServiceBinding" type="typens:HostIranSmsWebServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="send">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="sendToMany">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="deliveryStatus">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="verifyReceive">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="accountInfo">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="changePassword">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="changeTrafficRelay">
<soap:operation soapAction="urn:HostIranSmsWebServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:HostIranSmsWebService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="HostIranSmsWebService">
<port name="HostIranSmsWebServicePort" binding="typens:HostIranSmsWebServiceBinding">
<soap:address location="http://sms.hostiran.net/webservice/v1/index.php"/>
</port>
</service>
</definitions>
私のコード:
public String sendToMany(String username,String password,Category to,String msg,String from,Long time){
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.implicitTypes = true;
soapEnvelope.dotNet = true;
SoapObject soapReq = new SoapObject("urn:HostIranSmsWebService","sendToMany");
soapReq.addProperty("username",username);
soapReq.addProperty("password",password);
soapEnvelope.addMapping("urn:HostIranSmsWebService","to",new Category().getClass());
soapReq.addProperty("to",to);
soapReq.addProperty("msg",msg);
soapReq.addProperty("from",from);
soapReq.addProperty("time",time);
soapEnvelope.setOutputSoapObject(soapReq);
HttpTransportSE httpTransport = new HttpTransportSE(url);
try{
httpTransport.call("urn:HostIranSmsWebService/sendToMany", soapEnvelope);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public class Category extends Vector<String> implements KvmSerializable
{
/**
*
*/
private static final long serialVersionUID = -1166006770093411055L;
@Override
public Object getProperty(int arg0) {
return this.get(arg0);
}
@Override
public int getPropertyCount() {
return this.size();
}
@Override
public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) {
arg2.name = "string";
arg2.type = PropertyInfo.STRING_CLASS;
}
@Override
public void setProperty(int arg0, Object arg1) {
this.add(arg1.toString());
}
}
私のリクエストコード:
Category to =new Category();
to.add("1111111111");
to.add("2222222222");
to.add("3333333333");
String res = sendToMany("user1", "pass1", to, "hi", "",Long.valueOf(0));
日食のエラー:
11-14 16:19:51.317: D/msg(681): org.xmlpull.v1.XmlPullParserException: expected: END_TAG {http://schemas.xmlsoap.org/soap/envelope/}Body (position:END_TAG </{http://schemas.xmlsoap.org/soap/envelope/}SOAP-ENV:Fault>@2:199 in java.io.InputStreamReader@44c28540)
どこに問題があるのか 誰かが私を助けることができますか?