Solved

Axis Call is putting SOAP Body data in the Header

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 84
jar file executable 12 51
eclipse apache tomcat admin console 52 94
Unhandled exception type Exception 18 28
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 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…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

813 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

15 Experts available now in Live!

Get 1:1 Help Now