4 Protocol Examples

This section contains examples of request and response messages sent by the protocol client, protocol server, and the target Web service using this protocol.  In this sample scenario, the protocol client needs to query the HelloWorld operation on a Web service located at http://www.contoso.com/Service.asmx. The example messages use the XML namespace prefixes as specified in section 2.2.1. Example syntax for the relevant elements in a form template (.xsn) file is as described in [MS-IPFF] and [MS-IPFF2], and example syntax for a UDC file is as described in [MS-UDCX].

The following message is an example of a request message that a protocol client sends to the protocol server.

 POST /_vti_bin/FormsServiceProxy.asmx HTTP/1.1
 SOAPAction: "http://schemas.microsoft.com/office/infopath/2007/formsServicesProxy/ForwardSoapRequest"
 Content-Type: text/xml; charset="UTF-8"
 User-Agent: SOAP Toolkit 3.0
 Host: www.contoso.com
 Content-Length: 805
 Pragma: no-cache
 Cookie: MSOWebPartPage_AnonymousAccessCookie=80; WSS_KeepSessionAuthenticated=80
  
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP-ENV:Body>
 <tns:ForwardSoapRequest xmlns:tns="http://schemas.microsoft.com/office/infopath/2007/formsServicesProxy"><tns:xmlContent>
 <targetNS:HelloWorld xmlns:targetNS="http://www.contoso.com/Service.asmx">
 </targetNS:HelloWorld>
 </tns:xmlContent>
 <tns:version>1.0.0.3</tns:version>
 <tns:url>http://www.contoso.com/FormServerTemplates/example.xsn</tns:url>
 <tns:adapterName>query</tns:adapterName>
 </tns:ForwardSoapRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
  

The following message is an example of a successful response sent from the protocol server to the protocol client using this protocol.

 HTTP/1.1 200 OK
 Date: Mon, 21 Jan 2008 23:26:01 GMT
 Server: Microsoft-IIS/6.0
 X-Powered-By: ASP.NET
 X-AspNet-Version: 2.0.50727
 Set-Cookie: WSS_KeepSessionAuthenticated=80; path=/
 Cache-Control: private, max-age=0
 Content-Type: text/xml; charset=utf-8
 Content-Length: 561
  
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
 <ForwardSoapRequestResponse xmlns="http://schemas.microsoft.com/office/infopath/2007/formsServicesProxy">
 <ForwardSoapRequestResult>
 <HelloWorldResponse xmlns="http://www.contoso.com/Service.asmx">
 <HelloWorldResult>Hello World</HelloWorldResult>
 </HelloWorldResponse>
 </ForwardSoapRequestResult>
 </ForwardSoapRequestResponse>
 </soap:Body>
 </soap:Envelope>
  

The following message is an example of a failure response sent from the protocol server to the protocol client using this protocol.

 HTTP/1.1 500 Internal Server Error
 Date: Mon, 21 Jan 2008 23:40:24 GMT
 Server: Microsoft-IIS/6.0
 X-Powered-By: ASP.NET
 X-AspNet-Version: 2.0.50727
 Cache-Control: private
 Content-Type: text/xml; charset=utf-8
 Content-Length: 403
  
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
 <soap:Fault>
 <faultcode>soap:Server</faultcode>
 <faultstring>Server was unable to process request. ---&gt; Internal error.</faultstring>
 <detail />
 </soap:Fault>
 </soap:Body>
 </soap:Envelope>
  

The following message is an example of the request a protocol server sends the target Web service.

 POST /anon/service1.asmx
 HTTP/1.1
 User-Agent: InfoPathDA
 Content-Type: text/xml; charset="UTF-8"
 SOAPAction: "http://www.contoso.com/Service/HelloWorld"
 Host: www.contoso.com
 Cache-Control: no-store,no-cache
 Pragma: no-cache
 Content-Length: 704
 Expect: 100-continue
 Connection: Keep-Alive
  
 <?xml version="1.0" encoding="utf-8"?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
 <wsse:UsernameToken>
 <wsse:Username>CONTOSO\guest</wsse:Username>
 </wsse:UsernameToken>
 </wsse:Security>
 </SOAP-ENV:Header>
 <SOAP-ENV:Body>
 <targetNS:HelloWorld xmlns:targetNS="http://www.contoso.com/Service.asmx" />
 </SOAP-ENV:Body>
 </SOAP-ENV:Envelope>

The following message is an example of the response the target Web service sends to the protocol server.

 HTTP/1.1 200 OK
 Date: Wed, 13 Feb 2008 19:35:16 GMT
 Server: Microsoft-IIS/6.0
 X-Powered-By: ASP.NET
 X-AspNet-Version: 1.1.4322
 Cache-Control: private, max-age=0
 Content-Type: text/xml; charset=utf-8
 Content-Length: 374
  
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
 <HelloWorldResponse xmlns="http://www.contoso.com/Service.asmx">
 <HelloWorldResult>Hello World</HelloWorldResult>
 </HelloWorldResponse>
 </soap:Body>
 </soap:Envelope>