Solved

Axis Call is putting SOAP Body data in the Header

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights  challenge 17 61
noX challenge 17 76
strCopies  challenge 17 73
DO we need Java installed on a Windows PC and WHY ? 13 77
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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…

705 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

18 Experts available now in Live!

Get 1:1 Help Now