Hi,
Some bugs in my previous source code listing; here's the fixed version:
// create the input, output and fault messages associated with this operation
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
// at this point if you want to read the XML data from a file you could
// do something like
// Document doc = db.parse (new InputSource (new FileReader(..)));
Document document = db.newDocument();
// create element according to what is reqd by service, as specified in WSDL
Element topLevel = document.createElementNS("http://ws.cdyne.com","GetLatLong");
topLevel.setAttribute("xmlns","http://ws.cdyne.com");
document.appendChild(topLevel);
Element zip = document.createElement("zipcode");
Text zipValue = document.createTextNode(args[1]);
zip.appendChild(zipValue);
Element license = document.createElement("LicenseKey");
Text licenseValue = document.createTextNode("");
license.appendChild(licenseValue);
topLevel.appendChild(zip);
topLevel.appendChild(license);
WSIFMessage input = operation.createInputMessage();
WSIFMessage output = operation.createOutputMessage();
WSIFMessage fault = operation.createFaultMessage();
// populate the input message
input.setObjectPart("parameters",topLevel);
// do the invocation
if (operation.executeRequestResponseOperation(input, output, fault)) {
// invocation succeeded, extract information from output
// message
Element retValue = (Element) output.getObjectPart("parameters");
System.out.println("Got return value "+retValue);
Thanks,
Nirmal.
| [EMAIL PROTECTED]
01/08/2003 11:47 AM
|
To: [EMAIL PROTECTED] cc: Subject: [wsif] zip2geo sample questions |
In the WSDL for the Zip2Geo sample, the Message "GetLatLongSoapIn" contains
a single part of "parameters" which references the element "GetLatLong"
The sample code that invokes an operation using this message, the schema is
unwrapped and two input parts are being set vs. the single part that is
specified in the WSDL document. Also, this appears to be the case only
when and use="literal". Does anyone know the reasoning
behind this, i.e., the unwrapping of the element reference? Also, what
happens is the element references a sufficiently complexType whereby the
complexType is several layers deep and primitive types exist at each level?
Is a input part then required for each of those primitives?
Thanks much.
Rhett DeWall
Sybase Inc.
3665 Discovery Drive
Boulder, CO 80303
303/413-4163
