Solved

Axis Call is putting SOAP Body data in the Header

Posted on 2007-11-27
3
857 Views
Last Modified: 2012-05-05
I have used Apache Axis WSDL2Java to produce my Java wrapper to a working Web Service. I used Axis 1.3 and 1.4 individually, the code is identical except for comments.

When I make a call to the web service, the XML it is sending over is malformed. It is putting the Body into the Header.

This is what I get when I consume the same Web service in Visual Studio 2005 in C# .NET (it works):

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
      <soap:Header>
            <AuthenticationInfo xmlns="urn:HPD_Help_Desk_POC">
                  <userName>alexandjim</userName>
                  <password>jenny</password>
            </AuthenticationInfo>
      </soap:Header>
 
      <soap:Body>
            <OpCreate xmlns="urn:HPD_Help_Desk_POC">
                  <Assigned_Group>Internal Support</Assigned_Group>
                  <Assigned_Support_Company>My Company</Assigned_Support_Company>
                  <Assigned_Support_Organization>IT Support Organization</Assigned_Support_Organization>
                  <Company>My Company</Company>
                  <Contact_Company>My Company</Contact_Company>
                  <Description>Test Ticket from Web Service</Description>
                  <First_Name>Tommy</First_Name>
                  <Impact>4-Minor/Localized</Impact>
                  <Incident_Number>INC000000000081</Incident_Number>
                  <Last_Name>Tutone</Last_Name>
                  <Phone_Number>415-867-5309</Phone_Number>
                  <Priority>Low</Priority>
                  <Priority_Weight>0</Priority_Weight>
                  <Service_Type>Request</Service_Type>
                  <Status>New</Status>
                  <Submitter>Tommy Tutone</Submitter>
                  <Urgency>4-Low</Urgency>
                  <Person_ID>1982</Person_ID>
            </OpCreate>
      </soap:Body>
 
</soap:Envelope>

This is what I am getting from JBuilder 2007 using the Axis code (it doesn't work):

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
      <soapenv:Header>
            <AuthenticationInfo>
                  <userName>alexandjim</userName>
                  <password>jenny</password>
            </AuthenticationInfo>
 
            <ns1:OpCreate xmlns:ns1="urn:HPD_Help_Desk_POC">
                  <ns1:Assigned_Group>Internal Support</ns1:Assigned_Group>
                  <ns1:Assigned_Support_Company>My Company</ns1:Assigned_Support_Company>
                  <ns1:Assigned_Support_Organization>IT Support Organization</ns1:Assigned_Support_Organization>
                  <ns1:Company>My Company</ns1:Company>
                  <ns1:Contact_Company>My Company</ns1:Contact_Company>
                  <ns1:Description>Test Ticket from Web Service</ns1:Description>
                  <ns1:First_Name>Tommy</ns1:First_Name>
                  <ns1:Impact>4-Minor/Localized</ns1:Impact>
                  <ns1:Incident_Number>INC000000000081</ns1:Incident_Number>
                  <ns1:Last_Name>Tutone</ns1:Last_Name>
                  <ns1:Phone_Number>415-867-5309</ns1:Phone_Number>
                  <ns1:Priority>Low</ns1:Priority>
                  <ns1:Priority_Weight>0</ns1:Priority_Weight>
                  <ns1:Service_Type>Quick Case</ns1:Service_Type>
                  <ns1:Status>New</ns1:Status>
                  <ns1:Submitter>Tommy Tutone</ns1:Submitter>
                  <ns1:Urgency>4-Low</ns1:Urgency>
                  <ns1:Person_ID>1982</ns1:Person_ID>
            </ns1:OpCreate>
      </soapenv:Header>
 
      <soapenv:Body>
            <OpCreate xmlns=""/>
      </soapenv:Body>
 
</soapenv:Envelope>

Has anyone had this kind of issue before? I am at a complete loss about what to do.
--brian
0
Comment
3 Comments
 
LVL 6

Accepted Solution

by:
theonlygoodisknowledge earned 0 total points
ID: 20385386
I have a fix for this issue. Hopefully they will leave it in the system without any other comments, in case someone else has the same problem.

In the SoapBindingStub that was generated by WSDL2Java, there should be a line, or in this case it is broken into two lines, that looks something like this:

param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("urn:MyWebService", "OpGet"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:MyWebService", "GetInputMap"), com.mycompany.helloworld.mywebservice.GetInputMap.class, true, false);

oper.addParameter(param);

The last two booleans in the ParameterDesc are for inHeader and outHeader. They should both be set to false. That fixed it.

--brian
0
 
LVL 1

Expert Comment

by:modus_operandi
ID: 20403106
Closed, 500 points refunded.
modus_operandi
EE Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 82
jboss 7.1 start up error 1 35
java example issue 3 23
Eclipse Java import and method not resolved 4 48
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question