SolvedPrivate

SOAP Request Apachea Axis2 Client Requests to an external Server

Posted on 2013-05-17
3
77 Views
Last Modified: 2016-02-10
Hello,
i am using apache axis2  to create my SOAP request to the server from client

i have successfully recieved a working response message from the external soap service;
i have created 2 different Apache Axis2 Soap Java code files that creates then same request XML syntax
one of them is working. the other request response shows me a error message from the server


the thing is : both request syntaxes are the same

only the way i create them in apache axis2 is different:


My XML SOAP Request:
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CheckLogin xmlns="http://tempuri.org/">
<loginHeader
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"          
    xmlns:a="http://schemas.datacontract.org/2004/07/WcfService">
      <a:AgentId>*********</a:AgentId>
      <a:Username>*******</a:Username>
      <a:Password>********</a:Password>
      <a:Language>en</a:Language>
</loginHeader></CheckLogin></soap:Body></soap:Envelope>

during the creation of this syntax  :
if i use " loginHeader.declareNamespace()" to add those :i and :a to the syntax and  
create the child nodes with OMElement   _AgentId      = fac.createOMElement("AgentId", OMNamespace);

my request doesnt work on the server the server responses a error message the function needs language parameter . and so on...


but if i add these  i: and a:   with   the code syntax of " loginHeader.addAttribute("xmlns:a", "http://schemas.datacontract.org/2004/07/WcfService", null);

and also create the child nodes as with the code syntax of
OMElement   _AgentId      = fac.createOMElement("a:AgentId", null);

than it works on the server



why is this difference could any one can tell me ? to make me understand?
0
Comment
Question by:R_A_Y
[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 35

Expert Comment

by:mccarl
ID: 39177117
the thing is : both request syntaxes are the same
That can't be true since the server wouldn't give you different results then. Can you post the exact actual output request generated by each method? You can mask out sensitive details but please keep all the structural element stuff intact!
0
 

Author Comment

by:R_A_Y
ID: 39180213
(SoapContex-02.java)
<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><CountryList xmlns="http://tempuri.org/"><loginHeader xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/WcfService"><a:AgentId>***********</a:AgentId><a:Username>***********</a:Username><a:Password>********</a:Password><a:Language>en</a:Language></loginHeader></CountryList></soap:Body></soap:Envelope>

Returns this : Could not find stored procedure 'COUNTRY_LIST_WITH_CONTINENT_SUB_0_ML'.
when i ask the this message to the company they are saying that :" it seem to not getting the language parameter they said to get this message"

the second request is the working one :
(SoapContex.java)
<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><CountryList xmlns="http://tempuri.org/"><loginHeader xmlns:a="http://schemas.datacontract.org/2004/07/WcfService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:AgentId>**********************</a:AgentId><a:Language>en</a:Language><a:Password>****************</a:Password><a:Username>**************</a:Username></loginHeader></CountryList></soap:Body></soap:Envelope>


they are the same request ?
i also attached the creation code scripts of these requests
SoapContex.java
SoapContext-02.java
0
 
LVL 35

Accepted Solution

by:
girionis earned 500 total points
ID: 39180586
They are not the same requests. The <a:Language>en</a:Language> appears as the last element in one, while it appears as the second element in the other.

You also pass different information in the two requests, so content-wise they are not the same. It is possible that the user who tries to log in does not have the rights to run the COUNTRY_LIST_WITH_CONTINENT_SUB_0_ML stored procedure.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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.

726 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