私はJavaWebサービスクライアントプロジェクトを開発しています。その中で、javaからwsdl実装者の関連するjavaクラスにパラメータを送信する必要があります。私が使用しなければならないコードは次のとおりです。
private static SendSMSOutput sendSMS(tr.com.SomeProvider.sdp.mapping.generated.SendSMSInput requestPart) {
tr.com.SomeProvider.sdp.wsdl.generated.SendMessage service = new tr.com.SomeProvider.sdp.wsdl.generated.SendMessage();
tr.com.SomeProvider.sdp.wsdl.generated.SendMessagePort port = service.getSendMessagePort();
return port.sendSMS(requestPart);
}
メインクラスからこのメソッドにパラメータを送信する必要があります。
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"expirydate",
"messageclass",
"sdate",
"sender",
"shortnumber",
"srcmsisdn",
"nreq",
"toreceivers",
"messagebody"})
@XmlRootElement(name = "SendSMSInput")
public class SendSMSInput {
@XmlElement(name = "EXPIRY_DATE")
protected String expirydate;
@XmlElement(name = "MESSAGE_CLASS")
protected String messageclass;
@XmlElement(name = "S_DATE")
protected String sdate;
@XmlElement(name = "SENDER")
protected String sender;
@XmlElement(name = "SHORT_NUMBER", required = true)
protected String shortnumber;
@XmlElement(name = "SRC_MSISDN")
protected String srcmsisdn;
@XmlElement(name = "NREQ")
protected String nreq;
@XmlElement(name = "TO_RECEIVERS", required = true)
protected SendSMSInput.TORECEIVERS toreceivers;
@XmlElement(name = "MESSAGE_BODY", required = true)
protected SendSMSInput.MESSAGEBODY messagebody;
/**
* Gets the value of the expirydate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEXPIRYDATE() {
return expirydate;
}
/**
* Sets the value of the expirydate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEXPIRYDATE(String value) {
this.expirydate = value;
}
/**
* Gets the value of the messageclass property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMESSAGECLASS() {
return messageclass;
}
/**
* Sets the value of the messageclass property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMESSAGECLASS(String value) {
this.messageclass = value;
}
/**
* Gets the value of the sdate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSDATE() {
return sdate;
}
/**
* Sets the value of the sdate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSDATE(String value) {
this.sdate = value;
}
/**
* Gets the value of the sender property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSENDER() {
return sender;
}
/**
* Sets the value of the sender property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSENDER(String value) {
this.sender = value;
}
/**
* Gets the value of the shortnumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSHORTNUMBER() {
return shortnumber;
}
/**
* Sets the value of the shortnumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSHORTNUMBER(String value) {
this.shortnumber = value;
}
/**
* Gets the value of the srcmsisdn property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSRCMSISDN() {
return srcmsisdn;
}
/**
* Sets the value of the srcmsisdn property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSRCMSISDN(String value) {
this.srcmsisdn = value;
}
/**
* Gets the value of the nreq property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNREQ() {
return nreq;
}
/**
* Sets the value of the nreq property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNREQ(String value) {
this.nreq = value;
}
/**
* Gets the value of the toreceivers property.
*
* @return
* possible object is
* {@link SendSMSInput.TORECEIVERS }
*
*/
public SendSMSInput.TORECEIVERS getTORECEIVERS() {
return toreceivers;
}
/**
* Sets the value of the toreceivers property.
*
* @param value
* allowed object is
* {@link SendSMSInput.TORECEIVERS }
*
*/
public void setTORECEIVERS(SendSMSInput.TORECEIVERS value) {
this.toreceivers = value;
}
/**
* Gets the value of the messagebody property.
*
* @return
* possible object is
* {@link SendSMSInput.MESSAGEBODY }
*
*/
public SendSMSInput.MESSAGEBODY getMESSAGEBODY() {
return messagebody;
}
/**
* Sets the value of the messagebody property.
*
* @param value
* allowed object is
* {@link SendSMSInput.MESSAGEBODY }
*
*/
public void setMESSAGEBODY(SendSMSInput.MESSAGEBODY value) {
this.messagebody = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"message"
})
public static class MESSAGEBODY {
@XmlElement(required = true)
protected List<String> message;
/**
* Gets the value of the message property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the message property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMessage().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getMessage() {
if (message == null) {
message = new ArrayList<String>();
}
return this.message;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="msisdn" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"msisdn"
})
public static class TORECEIVERS {
@XmlElement(required = true)
protected List<String> msisdn;
/**
* Gets the value of the msisdn property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the msisdn property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMsisdn().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getMsisdn() {
if (msisdn == null) {
msisdn = new ArrayList<String>();
}
return this.msisdn;
}
}
}
私が理解している限り、SendInputの観点からパラメーターを送信する必要があります。expirydate、messageclass、sdate、sender、shortnumber、srcmsisdn、nreq、toreceivers、およびmessagebodyを運ぶようなペイロードを作成する必要があると思います。
私の質問は、これらのパラメーターを1つとしてSendSMSOutputメソッドに送信する方法です。前もって感謝します。
編集:ドキュメントでは、soapメッセージがどのように表示されるかは次のとおりです。
<soap:Body>
<sdp:SendSMSInput>
<sdp:EXPIRY_DATE>250106121212</sdp:EXPIRY_DATE>
<sdp:MESSAGE_CLASS>0</sdp:MESSAGE_CLASS>
<sdp:S_DATE>200106121212</sdp:S_DATE>
<sdp:SHORT_NUMBER>1905</sdp:SHORT_NUMBER>
<sdp:SRC_MSISDN>123123123123</sdp:SRC_MSISDN>
<sdp:TO_RECEIVERS>
<sdp:msisdn>123123123123</sdp:msisdn>
<sdp:msisdn>123123123123</sdp:msisdn>
</sdp:TO_RECEIVERS>
<sdp:MESSAGE_BODY>
<sdp:message>MESSAGE BODY GOES HERE</sdp:message>
<sdp:message>SECOND BODY GOES HERE</sdp:message>
</sdp:MESSAGE_BODY>
</sdp:SendSMSInput>
</soap:Body>