Solved

Axis Call is putting SOAP Body data in the Header

Posted on 2007-11-27
3
855 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now