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 Jon Hanshew <jh...@visa.com> on 2007/11/02 16:33:57 UTC
Re: [Axis2] How Do I Set mustUnderstand="0"?
I just love having these conversations with myself, but for anybody who is
interested I didn't want to leave the impression that the correct solution
was to modify the wsdl2java generated code.
Here is a better solution. All calls to modify the mustUnderstand flag are
made before the call to the stub.
ServiceStub stub = new ServiceStub(ctx, endpoint);
stub._getServiceClient().getOptions().setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"0");
response = stub.GetData(request);
Jon Hanshew wrote:
>
> Here is the solution. I had to make changes in the code generated by
> WSDL2Java.
>
> /* Here is the call I make from TestClient.java */
>
> response = stub.GetData(request);
>
> /* End of call I make from TestClient.java */
>
> /* Control transfers here in ServiceneStub.java, the code generated by
> WSDL2java. */
>
> public Service.client.ServiceStub.ResponseMessage GetData(
> Service.client.ServiceStub.RequestMessage requestMessage)
> throws java.rmi.RemoteException {
> try {
> org.apache.axis2.client.OperationClient _operationClient =
>
> _serviceClient.createClient(_operations[0].getName());
> _operationClient.getOptions().setAction("urn:GetData");
>
> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
>
> addPropertyToOperationClient(_operationClient,
>
> org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
> "&");
> /* End of WSDL2Java generated code
>
> /* Added this code to generated stub code to get "mustUnderstand"
>
> to disappear from SOAP header */
>
> addPropertyToOperationClient(_operationClient,
>
> org.apache.axis2.description.WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"0");
>
> /* WSDL2Java Generated code restarts here and continues on ... */
>
>
>
>
>
> Jon Hanshew wrote:
>>
>> I am using Axis2 1.3 and Rampart 1.3 basic security. My non-Axis service
>> requires that mustUnderstand be set to zero. It seems to be permanently
>> set to "1". I have looked everywhere in forums, documentation and source
>> code but have failed to find a solution. I do know that the
>> AddressingConstant parameters do not work in my case. I am not using
>> Addressing.
>>
>> Jon
>>
>
>
--
View this message in context: http://www.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tf4722713.html#a13550008
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] How Do I Set mustUnderstand="0"?
Posted by Jon Hanshew <jh...@visa.com>.
Here it is 2011 and Axis2-Rampart is up to 1.6. The solution I posted in
2007 no longer works, but this does:
ServiceStub stub = new ServiceStub(ctx, endpoint);
stub._getServiceClient().getOptions().setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"false");
Jon Hanshew wrote:
>
> I just love having these conversations with myself, but for anybody who is
> interested I didn't want to leave the impression that the correct solution
> was to modify the wsdl2java generated code.
>
> Here is a better solution. All calls to modify the mustUnderstand flag
> are made before the call to the stub.
>
> ServiceStub stub = new ServiceStub(ctx, endpoint);
>
> stub._getServiceClient().getOptions().setProperty(WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"0");
>
> response = stub.GetData(request);
>
>
>
> Jon Hanshew wrote:
>>
>> Here is the solution. I had to make changes in the code generated by
>> WSDL2Java.
>>
>> /* Here is the call I make from TestClient.java */
>>
>> response = stub.GetData(request);
>>
>> /* End of call I make from TestClient.java */
>>
>> /* Control transfers here in ServiceneStub.java, the code generated by
>> WSDL2java. */
>>
>> public Service.client.ServiceStub.ResponseMessage GetData(
>> Service.client.ServiceStub.RequestMessage requestMessage)
>> throws java.rmi.RemoteException {
>> try {
>> org.apache.axis2.client.OperationClient _operationClient =
>>
>> _serviceClient.createClient(_operations[0].getName());
>> _operationClient.getOptions().setAction("urn:GetData");
>>
>> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
>>
>> addPropertyToOperationClient(_operationClient,
>>
>> org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
>> "&");
>> /* End of WSDL2Java generated code
>>
>> /* Added this code to generated stub code to get "mustUnderstand"
>>
>> to disappear from SOAP header */
>>
>> addPropertyToOperationClient(_operationClient,
>>
>> org.apache.axis2.description.WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND,"0");
>>
>> /* WSDL2Java Generated code restarts here and continues on ... */
>>
>>
>>
>>
>>
>> Jon Hanshew wrote:
>>>
>>> I am using Axis2 1.3 and Rampart 1.3 basic security. My non-Axis
>>> service requires that mustUnderstand be set to zero. It seems to be
>>> permanently set to "1". I have looked everywhere in forums,
>>> documentation and source code but have failed to find a solution. I do
>>> know that the AddressingConstant parameters do not work in my case. I
>>> am not using Addressing.
>>>
>>> Jon
>>>
>>
>>
>
>
--
View this message in context: http://old.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tp13502520p32713862.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
RE: [Axis2] How Do I Set mustUnderstand="0"?
Posted by Beth Ayres <Be...@sas.com>.
Is there any way to configure mustUnderstand non-programatically? I may sometimes want it to be "0" and sometimes want it to be "1".
-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Wednesday, January 16, 2008 10:37 AM
To: axis-user@ws.apache.org
Subject: Re: [Axis2] How Do I Set mustUnderstand="0"?
Westpine-
You can do so programatically..e.g.
ConfigurationContext cfgCtx =
ConfigurationContextFactory.createDefaultConfigurationContext();
msgCtxt = cfgCtx.createMessageContext();
msgCtxt.setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HE
ADERS,
Boolean.TRUE);
M-
----- Original Message -----
From: "westpine" <we...@ukr.net>
To: <ax...@ws.apache.org>
Sent: Wednesday, January 16, 2008 4:08 AM
Subject: Re: [Axis2] How Do I Set mustUnderstand="0"?
>
> Hi! I have a little bit similar problem. But I need mustUnderstand
attribute
> to be vanished completely, not just set to "0". Because I have error "The
> request failed schema validation: The
> 'http://schemas.xmlsoap.org/soap/envelope/:mustUnderstand' attribute is
not
> declared." Do you know how to do that? Thanks!
> --
> View this message in context:
http://www.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tp13502
520p14875061.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] How Do I Set mustUnderstand="0"?
Posted by Martin Gainty <mg...@hotmail.com>.
Westpine-
You can do so programatically..e.g.
ConfigurationContext cfgCtx =
ConfigurationContextFactory.createDefaultConfigurationContext();
msgCtxt = cfgCtx.createMessageContext();
msgCtxt.setProperty(AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HE
ADERS,
Boolean.TRUE);
M-
----- Original Message -----
From: "westpine" <we...@ukr.net>
To: <ax...@ws.apache.org>
Sent: Wednesday, January 16, 2008 4:08 AM
Subject: Re: [Axis2] How Do I Set mustUnderstand="0"?
>
> Hi! I have a little bit similar problem. But I need mustUnderstand
attribute
> to be vanished completely, not just set to "0". Because I have error "The
> request failed schema validation: The
> 'http://schemas.xmlsoap.org/soap/envelope/:mustUnderstand' attribute is
not
> declared." Do you know how to do that? Thanks!
> --
> View this message in context:
http://www.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tp13502
520p14875061.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: [Axis2] How Do I Set mustUnderstand="0"?
Posted by Martin Gainty <mg...@hotmail.com>.
i would do the assignment before referecning the entity in the step e.g.
for (Iterator iter = omElementToadd.getChildren(); iter.hasNext();){
omNode = (OMNode) iter.next(); /* do the assignment of omNode first */
soapHeaderBlock.addChild(omNode);
}
OMAttribute omatribute = null;
// add attributes
for (Iterator iter = omElementToadd.getAllAttributes(); iter.hasNext();){
omatribute = (OMAttribute) iter.next(); /*do the assignment of omatribute first */
soapHeaderBlock.addAttribute(omatribute);
}
Martin
______________________________________________
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: Thu, 16 Sep 2010 04:25:59 -0700
> From: csaravindh@yahoo.com
> To: axis-user@ws.apache.org
> Subject: Re: [Axis2] How Do I Set mustUnderstand="0"?
>
>
> Use axis2 and override the method addHeader in your stub class as below
>
> protected void addHeader(OMElement omElementToadd, SOAPEnvelope
> envelop, boolean mustUnderstand)
> {
> SOAPHeaderBlock soapHeaderBlock =
> envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),
> omElementToadd.getNamespace());
>
> // Temporary Fix.
> if(mustUnderstand) {
> soapHeaderBlock.setMustUnderstand(mustUnderstand);
> }
>
> OMNode omNode = null;
> for(Iterator iter = omElementToadd.getChildren(); iter.hasNext();
> soapHeaderBlock.addChild(omNode))
> omNode = (OMNode)iter.next();
>
> OMAttribute omatribute = null;
> for(Iterator iter = omElementToadd.getAllAttributes();
> iter.hasNext(); soapHeaderBlock.addAttribute(omatribute))
> omatribute = (OMAttribute)iter.next();
>
> }
>
>
> westpine wrote:
> >
> > Hi! I have a little bit similar problem. But I need mustUnderstand
> > attribute to be vanished completely, not just set to "0". Because I have
> > error "The request failed schema validation: The
> > 'http://schemas.xmlsoap.org/soap/envelope/:mustUnderstand' attribute is
> > not declared." Do you know how to do that? Thanks!
> >
>
> --
> View this message in context: http://old.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tp13502520p29727373.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
Re: [Axis2] How Do I Set mustUnderstand="0"?
Posted by Aravi <cs...@yahoo.com>.
Use axis2 and override the method addHeader in your stub class as below
protected void addHeader(OMElement omElementToadd, SOAPEnvelope
envelop, boolean mustUnderstand)
{
SOAPHeaderBlock soapHeaderBlock =
envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),
omElementToadd.getNamespace());
// Temporary Fix.
if(mustUnderstand) {
soapHeaderBlock.setMustUnderstand(mustUnderstand);
}
OMNode omNode = null;
for(Iterator iter = omElementToadd.getChildren(); iter.hasNext();
soapHeaderBlock.addChild(omNode))
omNode = (OMNode)iter.next();
OMAttribute omatribute = null;
for(Iterator iter = omElementToadd.getAllAttributes();
iter.hasNext(); soapHeaderBlock.addAttribute(omatribute))
omatribute = (OMAttribute)iter.next();
}
westpine wrote:
>
> Hi! I have a little bit similar problem. But I need mustUnderstand
> attribute to be vanished completely, not just set to "0". Because I have
> error "The request failed schema validation: The
> 'http://schemas.xmlsoap.org/soap/envelope/:mustUnderstand' attribute is
> not declared." Do you know how to do that? Thanks!
>
--
View this message in context: http://old.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tp13502520p29727373.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: [Axis2] How Do I Set mustUnderstand="0"?
Posted by westpine <we...@ukr.net>.
Hi! I have a little bit similar problem. But I need mustUnderstand attribute
to be vanished completely, not just set to "0". Because I have error "The
request failed schema validation: The
'http://schemas.xmlsoap.org/soap/envelope/:mustUnderstand' attribute is not
declared." Do you know how to do that? Thanks!
--
View this message in context: http://www.nabble.com/-Axis2--How-Do-I-Set-mustUnderstand%3D%220%22--tp13502520p14875061.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org