I'm a newbie at this. I have an existing service and am
trying to write a Java client to call my service. My service request is sent in
the following format:
<?xml version="1.0" encoding="UTF-8" standalone="no"
?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<User>userid</User>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:updateComponent
xmlns:ns1="urn:cca:ClientComponentManager"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Transaction>
<WorkstationID
type="xsd:string">abcdefg123</WorkstationID>
<OS
version="4.0.950A">Windows 2000</OS>
<Browser
version="5.5.00">MSIE .5</Browser>
<Contact>
<EmailAddr>[EMAIL PROTECTED]</EmailAddr>
<Telephone>(205) 555-1212</Telephone>
</Contact>
<Component
id="ABCComponent" version="1.0.00">myComponent Name</Component>
</Transaction>
</ns1:updateComponent>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
When I try to write a call to do this as a test I loaded
my XML starting with the "Transaction" element into a w3c.dom.Document(). I then
load the root element (Transaction) and use addElement(new Parameter()) to load
my element into the Call. However, when I send my request my request has two
Transaction Elements:
<?xml version='1.0'
encoding='UTF-8'?> <WorkstationID type="xsd:string">abcdefg123</WorkstationID> <OS version="4.0.950A">Windows 2000</OS> <Browser version="5.5.00">MSIE 5.5</Browser> <Contact> <EmailAddr>[EMAIL PROTECTED]</EmailAddr> <Telephone>(334) 555-1212</Telephone> </Contact> <Component id="ABCComponent" version="1.0.00">myComponent Name</Component> </Transaction> I also tried simply using the addElement(new Parameter())
command for each of the subelements under Transaction, but then the Transaction
element gets duplicated like this:
<Transaction>
<WorkstationID
type="xsd:string">abcdefg123</WorkstationID>
</Transaction>
<Transaction>
</Transaction>
<Transaction>
</Transaction>
<Transaction>
<EmailAddr>[EMAIL PROTECTED]</EmailAddr>
<Telephone>(205) 555-1212</Telephone>
</Contact>
</Transaction>
<Transaction>
</Transaction> Here's how I call the service:
String myTrans = "<?xml
version=\"1.0\" encoding=\"UTF-8\" ?><Transaction><WorkstationID
type=\"xsd:string\">abcdefg123</WorkstationID> <OS
version=\"4.0.950A\">Windows 2000</OS><Browser
version=\"5.5.00\">MSIE
5.5</Browser><Contact><EmailAddr>[EMAIL PROTECTED]</EmailAddr><Telephone>(205)
555-1212</Telephone></Contact><Component id=\"ABCComponent\"
version=\"1.0.00\">myComponent
Name</Component></Transaction>";
|