axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svaens <>
Subject Re: Axis2 and wsdl- Exception thrown when client attempting connection to SimpleHTTPServer
Date Tue, 29 Apr 2008 11:53:23 GMT

Hi, thanks again for your replies!

I actually have it working now. HOWEVER!!! (isn't there always a catch!).
I still don't know what was the cause of the problem. 
I will explain how I got the client / server process to work. But first, let
me start from the start:

once upon a time.... 

I received a wsdl file from someone, and my task is to test it by creating a
server, and a client which can communicate. This is what I've been trying to
do. Call a wsdl function on the server, returning an serialized object to
the client as the response.  

So I took the wsdl file, and generated files for the server using , which came with the axis2.1_3 distribution.  I also generated
the Stub java file for the client using this tool and the source wsdl file. 

This is where I had my problem. The client could not successfully
communicate to the server. 

To get around this problem, I tried retrieving a NEWLY GENERATED WSDL file
from using the browser to contact the server and retrieve a wsdl file
generated from the generated Java files, which were in turn originally
generated from my source wsdl file. 

ALARM!!! The original wsdl file, and the newly generated wsdl files are NOT
the same!!! 
they differ in several ways. 

1. the targetNamespace attribute listed in the wsdl:definitions tag shows
the namespace backwards!!
2. The new generated wsdl file has two extra element types, 
    GetPersonInfo, and GetPersonInfoResponse,  + GetPersonInfoIn ,
while the original only game me GetPersonInfoOut & GetPersonInfoIn.

Never mind for now, I thought, I'll continue with this test, and see if it
works anyway. 

So I did, and so, with the introduction of these two extra types I had to
slightly modify my code, but, 
it worked!!!

What is going on here!!

Here is the new code, and how I had to adapt it to the different Stub file
generated from the changed wsdl:

            ConfigurationContext context = ConfigurationContextFactory.
        	PersonInfoStub stub =
                new PersonInfoStub(context);

            GetPersonInfo reqs =
                new GetPersonInfo();
			//GetPersonInfoIn req = reqs.getGetPersonInfoIn();
			GetPersonInfoIn req = new GetPersonInfoIn();
            GetPersonInfoResponse res = stub.getPersonInfo(reqs);
            GetPersonInfoOut resultObj = res.get_return();

			OMFactory fac = OMAbstractFactory.getOMFactory();
			OMElement xml = resultObj.getOMElement(GetPersonInfoResponse.MY_QNAME,
			//XMLOutputFactory xof = XMLOutputFactory.newInstance();		
			XMLStreamWriter writer =
			writeOMElement(xml, writer);
        //    System.out.println(res.getSuccessfulAdd());
        //    System.out.println(res.getItemId());
        } catch(Exception e){

Upul Godage wrote:
> Actually when you write and pass nulls,
> ConfigurationContext context =
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
> null);
> I think it uses a default bundled axi2.xml. So anyway an axis2.xml is
> used.
> When context path is not the one given in axis2.xml, axis2server redirects
> it to the context path. So the client may not be handling the redirect
> responses and returning error for code 301. But the browser is anyway
> supporting that.
> Upul

View this message in context:
Sent from the Axis - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message