I wrote a simple web service function using ASMX:
This should is used to handle SOAP request like the following:
It seems only the first <Message> can be processed. Here's the response:
Adding a dummy root in front of <Message> certainly can solve the problem. However the format of request is not allowed to be changed. Is there a simple way to read everything between the <Messages></Messages> tags?
Code:
Public Function processMessage(ByVal Messages as XMLElement) As String Dim strS as string strS = Messages.outerXML Return strS End Function
Code:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:gps-hex-communicator"> <soap:Header/> <soap:Body> <processMessage xmlns="urn:gps-hex-communicator"> <!--Optional:--> <Messages> <Message> <DeviceID>5901</DeviceID> <MessageID>201</MessageID> </Message> <Message> <DeviceID>5902</DeviceID> <MessageID>202</MessageID> </Message> </Messages> </processMessage> </soap:Body> </soap:Envelope>
Code:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <processMessageResponse xmlns="urn:gps-hex-communicator"> <processMessageResult><![CDATA[<Message xmlns="urn:gps-hex-communicator"> <DeviceID>5901</DeviceID> <MessageID>201</MessageID> </Message>]]></processMessageResult> </processMessageResponse> </soap:Body> </soap:Envelope>