You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Prasad Maddela <pr...@gmail.com> on 2011/02/24 20:15:16 UTC
Axis2 - Issue with RPCServiceClient - default namespace
Hi ,
I am using axis2-1.5.4 for web service development in my project and i have
encoutered below 2 issues,
request you to address these.
1. I have generated both service side and client-code using eclipse axis2
plugins , the static client stub works absolutely fine.
Since my project has more than 25 webservices to maintain , i tried to
come up with a dynamic client using 'RPCServiceClient'
but unfortunately the client is erroring out with the following error
: (attached the entire statck trace in stacktrace.txt)
org.apache.axis2.AxisFault: *
org.apache.axis2.databinding.ADBException*: Unexpected subelement
PlacementRequest
at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(*
Utils.java:446*)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(*
OutInAxisOperation.java:371*)
i found that this is due to namespace mismatch problem related to the
'PlacementRequest' element ,
wsdl namespace :
http://www.scte.org/wsdl/130-3/2010/ads
xsd types
: xmlns:adm="http://www.scte.org/schemas/130-3/2008a/adm"
its considering the wsdl's namespace for 'PlacementRequest' which is
leading to the exception,
below is the snippet of the code responsible for the exception:
*
if
*(reader.isStartElement() && *new* javax.xml.namespace.QName("
http://www.scte.org/schemas/130-3/2008a/adm","PlacementRequest")
.equals(reader.getName())){
object.setPlacementRequest(org.scte.www.schemas._130_3._2008a.adm.PlacementRequestType.Factory.
*parse*(reader));
} // End of if for expected property start element
* else*{
// A start element we are not expecting indicates an
invalid parameter was passed
*throw* *new*
org.apache.axis2.databinding.ADBException("Unexpected
subelement " + reader.getLocalName());
}
2. Another problem i noted is server & client code generated from wsdl
is giving some errors related to if-else blocks,
would be great if you can also look at this.
*I have enclosed all the files(wsdl,static client stub,dynamic client
code,sample input xml).*
Thanking you for your
wonderful support and time.
M.Prasad Rao
RE: Axis2 - Issue with RPCServiceClient - default namespace
Posted by Martin Gainty <mg...@hotmail.com>.
xsd is assigned with -xsdconfig option of wsdl2java (in combination with -d xmlbeans style)
wsdl2java | grep xsd
-xsdconfig <file path> Use XMLBeans .xsdconfig file. Valid only with -d xmlbeans.
but if you are using -nsp ns1=Wsdl_package the package is identified for each namespace in wsdl schema
wsdl2java | grep wsdl
-ns2p ns1=pkg1,ns2=pkg2 Specify a custom package name for each namespace specified in the wsdls schema.
does this not conform the the behaviour you are seeing?
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
Date: Fri, 25 Feb 2011 00:57:34 +0530
Subject: Axis2 - Issue with RPCServiceClient - default namespace
From: prasadrao.maddela@gmail.com
To: java-user@axis.apache.org
Hi ,
I am using axis2-1.5.4 for web service development in my project and i have encoutered below 2 issues,
request you to address these.
1. I have generated both service side and client-code using eclipse axis2 plugins , the static client stub works absolutely fine.
Since my project has more than 25 webservices to maintain , i tried to come up with a dynamic client using 'RPCServiceClient'
but unfortunately the client is erroring out with the following error : (attached the entire statck trace in stacktrace.txt)
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement PlacementRequest
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
i found that this is due to namespace mismatch problem related to the 'PlacementRequest' element ,
wsdl namespace : http://www.scte.org/wsdl/130-3/2010/ads
xsd types : xmlns:adm="http://www.scte.org/schemas/130-3/2008a/adm"
its considering the wsdl's namespace for 'PlacementRequest' which is leading to the exception,
below is the snippet of the code responsible for the exception:
if(reader.isStartElement() && new javax.xml.namespace.QName("http://www.scte.org/schemas/130-3/2008a/adm","PlacementRequest").equals(reader.getName())){
object.setPlacementRequest(org.scte.www.schemas._130_3._2008a.adm.PlacementRequestType.Factory.parse(reader));
} // End of if for expected property start element
else{
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
2. Another problem i noted is server & client code generated from wsdl is giving some errors related to if-else blocks,
would be great if you can also look at this.
I have enclosed all the files(wsdl,static client stub,dynamic client code,sample input xml).
Thanking you for your wonderful support and time.
M.Prasad Rao
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Axis2 - Issue with RPCServiceClient - default namespace
Posted by Prasad Maddela <pr...@gmail.com>.
Hi ,
I am using axis2-1.5.4 for web service development in my project and i have
encoutered below 2 issues,
request you to address these.
1. I have generated both service side and client-code using eclipse axis2
plugins , the static client stub works absolutely fine.
Since my project has more than 25 webservices to maintain , i tried to
come up with a dynamic client using 'RPCServiceClient'
but unfortunately the client is erroring out with the following error
: (attached the entire statck trace in stacktrace.txt)
org.apache.axis2.AxisFault: *
org.apache.axis2.databinding.ADBException*: Unexpected subelement
PlacementRequest
at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(*
Utils.java:446*)
at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(*
OutInAxisOperation.java:371*)
i found that this is due to namespace mismatch problem related to the
'PlacementRequest' element ,
wsdl namespace :
http://www.scte.org/wsdl/130-3/2010/ads
xsd types
: xmlns:adm="http://www.scte.org/schemas/130-3/2008a/adm"
its considering the wsdl's namespace for 'PlacementRequest' which is
leading to the exception,
below is the snippet of the code responsible for the exception:
*
if
*(reader.isStartElement() && *new* javax.xml.namespace.QName("
http://www.scte.org/schemas/130-3/2008a/adm","PlacementRequest")
.equals(reader.getName())){
object.setPlacementRequest(org.scte.www.schemas._130_3._2008a.adm.PlacementRequestType.Factory.
*parse*(reader));
} // End of if for expected property start element
* else*{
// A start element we are not expecting indicates an
invalid parameter was passed
*throw* *new*
org.apache.axis2.databinding.ADBException("Unexpected
subelement " + reader.getLocalName());
}
2. Another problem i noted is server & client code generated from wsdl
is giving some errors related to if-else blocks,
would be great if you can also look at this.
*I have enclosed all the files(wsdl,static client stub,dynamic client
code,sample input xml).*
Thanking you for your
wonderful support and time.
M.Prasad Rao
RE: Axis2 - Issue with RPCServiceClient - default namespace
Posted by Martin Gainty <mg...@hotmail.com>.
1)construct a payload element which will contain the soap message you
want to send to the awaiting Axis service toy will need to supply the payload as a 2nd parameter to
2)call opClient.sendReceiveNonBlocking(ANON_OUT_IN_OP,parentElementToSend,callback);
/**
* here is the sendReceiveNonBlocking method
*
* Directly invoke a named operation with an In-Out MEP without waiting for a response. This
* method sends your supplied XML with response notification to your callback handler. For more
* control, you can instead create a client for the operation and use that client to execute the
* exchange.
*
* @param operation name of operation to be invoked (non-<code>null</code>)
* @param elem the data to send (becomes the content of SOAP body)
* @param callback a Callback which will be notified upon completion
* @throws AxisFault in case of error
* @see #createClient(QName)
* @deprecated Please use the AxisCallback interface rather than Callback, which has been
* deprecated
*/
public void sendReceiveNonBlocking(QName operation, OMElement elem, Callback callback)
throws AxisFault {
MessageContext mc = new MessageContext();
fillSOAPEnvelope(mc, elem);
OperationClient mepClient = createClient(operation);
// here a blocking invocation happens in a new thread, so the
// progamming model is non blocking
mepClient.setCallback(callback);
mepClient.addMessageContext(mc);
mepClient.execute(false);
}
Hi,
I am using an OperationClient to invoke different web services asynchronously.
I am passing a callback method to the operationclient as following.
MyCallBack Class:
AxisCallback callBack = new AxisCallback(){
public synchronized void onMessage(MessageContext msgContext){
SOAPBody msg = msgContext.getEnvelope().getBody();
System.out.println("this is the envelope"+msgContext.getEnvelope());
System.out.println("Inside onMessage: "+msg);
}
public void onComplete() {
// TODO Auto-generated method stub
System.out.println("Invocation is complete");
//System.exit(0);
}
@Override
public void onError(Exception e) {
// TODO Auto-generated method stub
System.out.println("Inside onError: "+e.getMessage());
}
public void onFault(MessageContext msgContext) {
// TODO Auto-generated method stub
System.out.println("Inside onFault: "+msgContext.getFailureReason().toString());
msgContext.getFailureReason().printStackTrace();
}
};
ServiceClient sc = new ServiceClient();
OperationClient opClient = sc.createClient(
ServiceClient.ANON_OUT_IN_OP);
MessageContext outMsgCtx = new MessageContext();
//assigning message context's option object into instance variable
Options opts = outMsgCtx.getOptions();
//setting properties into option
opts.setTo(new EndpointReference(
endPoint));
opts.setAction(action);
sc.engageModule("addressing");
opClient.addMessageContext(outMsgCtx);
opts.setUseSeparateListener(true);
outMsgCtx.setEnvelope(createSOAPEnvelope);//createSOAPEnvelope returns soap envelope
// opClient.setCallback(callBack);
//opClient.execute(true);
//construct your parentElementToSend payload and supply that as 2nd parameter
//here is an example from MexClient
//change your namespace to match the namespace you are using
//change the 1st parameter of createOMElement to be the actual payload you are sending..
//factory
OMFactory fac = OMAbstractFactory.getOMFactory();
//create namespace from factory
OMNamespace omNs = fac.createOMNamespace(DRConstants.SPEC.NS_URI,DRConstants.SPEC.NS_PREFIX);
//create element from factory
OMElement parentElementToSend = fac.createOMElement(DRConstants.SPEC.GET_METADATA, omNs);
opClient.sendReceiveNonBlocking(ANON_OUT_IN_OP,parentElementToSend,callback);
while(true){
Thread.sleep(100);
}
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
Date: Fri, 25 Feb 2011 00:45:16 +0530
Subject: Axis2 - Issue with RPCServiceClient - default namespace
From: prasadrao.maddela@gmail.com
To: java-dev@axis.apache.org
Hi ,
I am using axis2-1.5.4 for web service development in my project and i have encoutered below 2 issues,
request you to address these.
1. I have generated both service side and client-code using eclipse axis2 plugins , the static client stub works absolutely fine.
Since my project has more than 25 webservices to maintain , i tried to come up with a dynamic client using 'RPCServiceClient'
but unfortunately the client is erroring out with the following error : (attached the entire statck trace in stacktrace.txt)
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement PlacementRequest
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
i found that this is due to namespace mismatch problem related to the 'PlacementRequest' element ,
wsdl namespace : http://www.scte.org/wsdl/130-3/2010/ads
xsd types : xmlns:adm="http://www.scte.org/schemas/130-3/2008a/adm"
its considering the wsdl's namespace for 'PlacementRequest' which is leading to the exception,
below is the snippet of the code responsible for the exception:
if(reader.isStartElement() && new javax.xml.namespace.QName("http://www.scte.org/schemas/130-3/2008a/adm","PlacementRequest").equals(reader.getName())){
object.setPlacementRequest(org.scte.www.schemas._130_3._2008a.adm.PlacementRequestType.Factory.parse(reader));
} // End of if for expected property start element
else{
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
2. Another problem i noted is server & client code generated from wsdl is giving some errors related to if-else blocks,
would be great if you can also look at this.
I have enclosed all the files(wsdl,static client stub,dynamic client code,sample input xml).
Thanking you for your wonderful support and time.
M.Prasad Rao
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
RE: Axis2 - Issue with RPCServiceClient - default namespace
Posted by Martin Gainty <mg...@hotmail.com>.
1)construct a payload element which will contain the soap message you
want to send to the awaiting Axis service toy will need to supply the payload as a 2nd parameter to
2)call opClient.sendReceiveNonBlocking(ANON_OUT_IN_OP,parentElementToSend,callback);
/**
* here is the sendReceiveNonBlocking method
*
* Directly invoke a named operation with an In-Out MEP without waiting for a response. This
* method sends your supplied XML with response notification to your callback handler. For more
* control, you can instead create a client for the operation and use that client to execute the
* exchange.
*
* @param operation name of operation to be invoked (non-<code>null</code>)
* @param elem the data to send (becomes the content of SOAP body)
* @param callback a Callback which will be notified upon completion
* @throws AxisFault in case of error
* @see #createClient(QName)
* @deprecated Please use the AxisCallback interface rather than Callback, which has been
* deprecated
*/
public void sendReceiveNonBlocking(QName operation, OMElement elem, Callback callback)
throws AxisFault {
MessageContext mc = new MessageContext();
fillSOAPEnvelope(mc, elem);
OperationClient mepClient = createClient(operation);
// here a blocking invocation happens in a new thread, so the
// progamming model is non blocking
mepClient.setCallback(callback);
mepClient.addMessageContext(mc);
mepClient.execute(false);
}
Hi,
I am using an OperationClient to invoke different web services asynchronously.
I am passing a callback method to the operationclient as following.
MyCallBack Class:
AxisCallback callBack = new AxisCallback(){
public synchronized void onMessage(MessageContext msgContext){
SOAPBody msg = msgContext.getEnvelope().getBody();
System.out.println("this is the envelope"+msgContext.getEnvelope());
System.out.println("Inside onMessage: "+msg);
}
public void onComplete() {
// TODO Auto-generated method stub
System.out.println("Invocation is complete");
//System.exit(0);
}
@Override
public void onError(Exception e) {
// TODO Auto-generated method stub
System.out.println("Inside onError: "+e.getMessage());
}
public void onFault(MessageContext msgContext) {
// TODO Auto-generated method stub
System.out.println("Inside onFault: "+msgContext.getFailureReason().toString());
msgContext.getFailureReason().printStackTrace();
}
};
ServiceClient sc = new ServiceClient();
OperationClient opClient = sc.createClient(
ServiceClient.ANON_OUT_IN_OP);
MessageContext outMsgCtx = new MessageContext();
//assigning message context's option object into instance variable
Options opts = outMsgCtx.getOptions();
//setting properties into option
opts.setTo(new EndpointReference(
endPoint));
opts.setAction(action);
sc.engageModule("addressing");
opClient.addMessageContext(outMsgCtx);
opts.setUseSeparateListener(true);
outMsgCtx.setEnvelope(createSOAPEnvelope);//createSOAPEnvelope returns soap envelope
// opClient.setCallback(callBack);
//opClient.execute(true);
//construct your parentElementToSend payload and supply that as 2nd parameter
//here is an example from MexClient
//change your namespace to match the namespace you are using
//change the 1st parameter of createOMElement to be the actual payload you are sending..
//factory
OMFactory fac = OMAbstractFactory.getOMFactory();
//create namespace from factory
OMNamespace omNs = fac.createOMNamespace(DRConstants.SPEC.NS_URI,DRConstants.SPEC.NS_PREFIX);
//create element from factory
OMElement parentElementToSend = fac.createOMElement(DRConstants.SPEC.GET_METADATA, omNs);
opClient.sendReceiveNonBlocking(ANON_OUT_IN_OP,parentElementToSend,callback);
while(true){
Thread.sleep(100);
}
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
Date: Fri, 25 Feb 2011 00:45:16 +0530
Subject: Axis2 - Issue with RPCServiceClient - default namespace
From: prasadrao.maddela@gmail.com
To: java-dev@axis.apache.org
Hi ,
I am using axis2-1.5.4 for web service development in my project and i have encoutered below 2 issues,
request you to address these.
1. I have generated both service side and client-code using eclipse axis2 plugins , the static client stub works absolutely fine.
Since my project has more than 25 webservices to maintain , i tried to come up with a dynamic client using 'RPCServiceClient'
but unfortunately the client is erroring out with the following error : (attached the entire statck trace in stacktrace.txt)
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement PlacementRequest
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
i found that this is due to namespace mismatch problem related to the 'PlacementRequest' element ,
wsdl namespace : http://www.scte.org/wsdl/130-3/2010/ads
xsd types : xmlns:adm="http://www.scte.org/schemas/130-3/2008a/adm"
its considering the wsdl's namespace for 'PlacementRequest' which is leading to the exception,
below is the snippet of the code responsible for the exception:
if(reader.isStartElement() && new javax.xml.namespace.QName("http://www.scte.org/schemas/130-3/2008a/adm","PlacementRequest").equals(reader.getName())){
object.setPlacementRequest(org.scte.www.schemas._130_3._2008a.adm.PlacementRequestType.Factory.parse(reader));
} // End of if for expected property start element
else{
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
2. Another problem i noted is server & client code generated from wsdl is giving some errors related to if-else blocks,
would be great if you can also look at this.
I have enclosed all the files(wsdl,static client stub,dynamic client code,sample input xml).
Thanking you for your wonderful support and time.
M.Prasad Rao
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org