我是ColdFusion的新手,需要編寫代碼來使用基於SOAP的Web服務。消費具有複雜類型的SOAP Web服務
任何用於消費具有複雜類型的基於SOAP的Web服務的鏈接/指針/示例都將有所幫助。
當我在ColdFusion中編寫消費以下Web服務的代碼時,應該如何處理操作名稱,輸入消息和複雜類型?只需要一些指針即可開始。
XSD是一樣的東西:
<!-- S Request -->
<xs:complexType name="SRequestHeader">
+ <xs:sequence>
+ <xs:element name="sID" minOccurs="1" maxOccurs="1"> </xs:element>
+ <xs:element name="orderNumber" minOccurs="1" maxOccurs="1"> </xs:element>
+ <xs:element name="dateCreated" minOccurs="1" maxOccurs="1"> </xs:element>
</xs:complexType>
- <xs:complexType name="SOrderLine">
- <xs:sequence>
- <xs:element name="lineNumber" minOccurs="1" maxOccurs="1"> </xs:element>
- <xs:element name="recordType" minOccurs="1" maxOccurs="1"> </xs:element>
- <xs:element name="dueDate" minOccurs="1" type="xs:dateTime" />
</xs:complexType>
......
WSDL有:
<WL:portType name="SPortType">
- <WL:operation name="newOrder">
<WL:input message="WL:newOrderRequest" name="newOrderRequest" />
<WL:output> message="W:newOrderResponse" name="newOrderResponse" />
<WL:fault> message="WL:WSException" name="WSException" />
</WL:operation>
我使用的是這樣的:
<soapenv:Body>
<newOrder>
<soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sor:newOrderRequest>
<sor:SOrderRequest>
<sor:sID>S123</sor:sID> ....
最後...
<cfhttp url="http://xxxx:123/YYY/SService" method="post" timeout="118"
throwonerror="yes">
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="">
<cfhttpparam type="header" name="content-length" value="#len(soap)#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" name="message" value="#trim(soap)#">
</cfhttp>
獲取有關該行500內部服務器錯誤:
<cfhttpparam type="xml" name="message" value="#trim(soap)#">
指針編號1 - 您可能需要創建一個對象。有一個標籤,和一個函數CreateObject(),可以讓你做到這一點。谷歌每個並決定你想使用哪一個。我更喜歡後者。 –
@DanBracuk我使用類似於: \t \t S123 .... –
user2286338