You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Igor Barma <ig...@pentila.com> on 2008/12/17 17:16:24 UTC

Axis2 stub targetnamespace configuration

Hi everybody,
I made a simple SOAP client using wsdl2java.sh, ii have no problems  
and it works fine.
My goal is to have a client that i can easly configure to request  
different WS target.

here is my simply code i play with:

MoodleWSStub stub = new MoodleWSStub();
LoginDocument loginDocument= LoginDocument.Factory.newInstance();
LoginDocument.Login loginDocumentLogin= loginDocument.addNewLogin();
loginDocumentLogin.setUsername("-----");
loginDocumentLogin.setPassword("-----");
loginDocument.setLogin(loginDocumentLogin);
LoginResponseDocument rep=stub.login(loginDocument);

This request works and uses configuration from my wsdl file. The wsdl  
i used to create my stub with wsdl2java

Now, i want to configure this client to request an other WSTarget (in  
fact, i just change the port of my WS server).

So, in my client i now call:
...
MoodleWSStub stub = new MoodleWSStub("http://localhost:PORT/../../..");
...

This nearly works but in my SOAP request i have always the old  
namespace definition and so, the following error:

org.apache.axis2.AxisFault: error: The document is not a loginResponse@http://localhost:8890/moodle19/wspp/wsdl 
: document element namespace mismatch expected "http://localhost:8890/moodle19/wspp/wsdl 
" got "http://localhost:8891/moodle19/wspp/wsdl"
	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
	at localhost.moodle19.wspp.wsdl.MoodleWSStub.fromOM(MoodleWSStub.java: 
19923)
	at localhost.moodle19.wspp.wsdl.MoodleWSStub.login(MoodleWSStub.java: 
2827)
	at Test1.main(Test1.java:61)
Caused by: org.apache.xmlbeans.XmlException: error: The document is  
not a loginResponse@http://localhost:8890/moodle19/wspp/wsdl: document  
element namespace mismatch expected "http://localhost:8890/moodle19/wspp/wsdl 
" got "http://localhost:8891/moodle19/wspp/wsdl"
	at  
org.apache.xmlbeans.impl.store.Locale.verifyDocumentType(Locale.java: 
452)
	at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java: 
357)
	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java: 
850)
	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java: 
826)
	at  
org 
.apache 
.xmlbeans 
.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:231)
	at localhost.moodle19.wspp.wsdl.LoginResponseDocument 
$Factory.parse(LoginResponseDocument.java:128)
	at localhost.moodle19.wspp.wsdl.MoodleWSStub.fromOM(MoodleWSStub.java: 
19002)
	... 2 more



Is anybody knows how can i change the namespace attribute, generated  
by the axis2 stub.

Thx

Igor Barma
igor@pentila.com

Ce message est protégé par les règles relatives au secret de la  
correspondance ; il peut, en outre, contenir des informations à  
caractère confidentiel ou protégées par différentes règles  
déontologiques ; il est établi à destination exclusive de son  
destinataire. Toute divulgation, utilisation, diffusion ou  
reproduction (totale ou partielle) de ce message, ou des informations  
qu'il contient, doit être préalablement autorisée. Tout message  
électronique est susceptible d'altération et son intégrité ne peut  
être assurée. L'auteur décline toute responsabilité au titre de ce  
message s'il a été modifié ou falsifié. Si vous n'êtes pas  
destinataire de ce message, merci de le détruire immédiatement et  
d'avertir l'expéditeur de l'erreur de distribution et de la  
destruction du message.






Re: Axis2 stub targetnamespace configuration

Posted by Amila Suriarachchi <am...@gmail.com>.
2008/12/17 Igor Barma <ig...@pentila.com>

> Hi everybody,
> I made a simple SOAP client using wsdl2java.sh, ii have no problems and it
> works fine.
> My goal is to have a client that i can easly configure to request different
> WS target.
>
> here is my simply code i play with:
>
> MoodleWSStub stub = new MoodleWSStub();
> LoginDocument loginDocument= LoginDocument.Factory.newInstance();
> LoginDocument.Login loginDocumentLogin= loginDocument.addNewLogin();
> loginDocumentLogin.setUsername("-----");
> loginDocumentLogin.setPassword("-----");
> loginDocument.setLogin(loginDocumentLogin);
> LoginResponseDocument rep=stub.login(loginDocument);
>
> This request works and uses configuration from my wsdl file. The wsdl i
> used to create my stub with wsdl2java
>
> Now, i want to configure this client to request an other WSTarget (in fact,
> i just change the port of my WS server).
>
> So, in my client i now call:
> ...
> MoodleWSStub stub = new MoodleWSStub("http://localhost:PORT/../../..");
> ...
>
> This nearly works but in my SOAP request i have always the old namespace
> definition and so, the following error:
>
> org.apache.axis2.AxisFault: error: The document is not a loginResponse@
> http://localhost:8890/moodle19/wspp/wsdl: document element namespace
> mismatch expected "http://localhost:8890/moodle19/wspp/wsdl" got "
> http://localhost:8891/moodle19/wspp/wsdl"
> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
> at localhost.moodle19.wspp.wsdl.MoodleWSStub.fromOM(
> MoodleWSStub.java:19923)
> at localhost.moodle19.wspp.wsdl.MoodleWSStub.login(MoodleWSStub.java:2827)
> at Test1.main(Test1.java:61)
> Caused by: org.apache.xmlbeans.XmlException: error: The document is not a
> loginResponse@http://localhost:8890/moodle19/wspp/wsdl: document element
> namespace mismatch expected "http://localhost:8890/moodle19/wspp/wsdl" got
> "http://localhost:8891/moodle19/wspp/wsdl"
> at org.apache.xmlbeans.impl.store.Locale.verifyDocumentType(
> Locale.java:452)
> at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java:357)
> at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:850)
> at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:826)
> at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(
> SchemaTypeLoaderBase.java:231)
> at localhost.moodle19.wspp.wsdl.LoginResponseDocument$Factory.parse(
> LoginResponseDocument.java:128)
> at localhost.moodle19.wspp.wsdl.MoodleWSStub.fromOM(
> MoodleWSStub.java:19002)
> ... 2 more
>
>
>
> Is anybody knows how can i change the namespace attribute, generated by the
> axis2 stub.
>

This is not a possible option.

thanks,
Amila.

>
> Thx
>
> Igor Barma
> igor@pentila.com
>
> Ce message est protégé par les règles relatives au secret de la
> correspondance ; il peut, en outre, contenir des informations à caractère
> confidentiel ou protégées par différentes règles déontologiques ; il est
> établi à destination exclusive de son destinataire. Toute divulgation,
> utilisation, diffusion ou reproduction (totale ou partielle) de ce message,
> ou des informations qu'il contient, doit être préalablement autorisée. Tout
> message électronique est susceptible d'altération et son intégrité ne peut
> être assurée. L'auteur décline toute responsabilité au titre de ce message
> s'il a été modifié ou falsifié. Si vous n'êtes pas destinataire de ce
> message, merci de le détruire immédiatement et d'avertir l'expéditeur de
> l'erreur de distribution et de la destruction du message.
>
>
>
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/