• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

XML generated from Apache Axis incorrect when called from inside Weblogic (Namespace is incorrrect)

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic