?
Solved

Axis Call is putting SOAP Body data in the Header

Posted on 2007-11-27
3
Medium Priority
?
863 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
Question by:Brian Bush
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
Brian Bush 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 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