I need to call a web service as a client from a web logic server.
I took the WSDL and used Apache Axis to generate the java stubs.
Then I wrote some java to make the web service call.
I tested my java code by writing a small JUnit test and everything worked.
Then I put all my code into a EAR file and deployed it to a weblogic server and the code did not work.
I then looked at the XML generated by each process
JUnit Test (Works)
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<UserCredential xmlns="http://api.erecyclingcorps.com" soapenv:mustUnderstand="0">
<password xmlns="">secret</password>
<username xmlns="">user</username>
</UserCredential>
</soapenv:Header>
<soapenv:Body>
<api:GetToken xmlns:api="http://api.erecyclingcorps.com">
<operation>NEW_QUOTE</operation>
<accountNumber>123456</accountNumber>
<companyName>company</companyName>
<emailAddress>
[email protected]</emailAddress>
<ecpdID>583582</ecpdID>
<subAccountNumber>subaccount</subAccountNumber>
</api:GetToken>
</soapenv:Body>
</soapenv:Envelope>
XML coming from WebLogic (Does not work)
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<UserCredential xmlns="http://api.erecyclingcorps.com" soapenv:mustUnderstand="0">
<password xmlns="">secret</password>
<username>username</username>
</UserCredential>
</soapenv:Header>
<soapenv:Body>
<api:GetToken xmlns:api="http://api.erecyclingcorps.com">
<operation>NEW_QUOTE</operation>
<ecpdID>583582</ecpdID>
<accountNumber>123456</accountNumber>
<subAccountNumber>subaccount</subAccountNumber>
<companyName>WEST MYBIZ TEST ACCT-PINK</companyName>
<emailAddress>
[email protected]</emailAddress>
</api:GetToken>
</soapenv:Body>
</soapenv:Envelope>
Notice that the namespace is incorrect for the username element when the code is called from weblogic.
I do not understand why the same code would behave differently when called from weblogic.
This causes the web service server to reject the request with the error message "username is required".
Anyone see this problem before