In this step, you must put the SOAP XML document into the HTTP request. This means you have to use elements in the SOAP standard for the server to be able to parse the document and provide the appropriate response. Assembling an XML document within a program does not require a parser. Consider the following code snippet.
String BodyVariable1 = "<countryNamexsi:type=\"xsd:string\">";
This simple piece of code starts to build an XML document. The problem here is that there is no way to determine whether the XML you build is well formed and valid. Thus, it may be difficult to determine why your request fails to the server. If an XML parser is unavailable to you, creating a method that can dump out the XML your program creates gives you the opportunity to move the XML document to a place where you can test the document’s validity. Even just trying to load this document into Internet Explorer would be sufficient. If a parser such as Apache Xerces is available to you, a Web Services implementation is probably also available. Figure 13.2 shows that creating the request involves piggybacking the XML with the HTTP request.
Figure 13.2: The HTTP request to the server must include the appropriate XML from the SOAP standard.