You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by Sanka Samaranayake <ss...@gmail.com> on 2005/08/26 19:16:51 UTC

[Patch] errors in org.apache.sandesha2.wsrm package

Dear Sandesha Committers,

It seems that there are few errors in the classes in 
org.apache.sandesha2.wsrm package concerning the methods 
fromSOAPEnvelope(), toSOAPEnvelope().

Please accept the patch I've included which will resolve those errors.

Thanks,
Sanka Samaranayake


Re: [Patch] errors in org.apache.sandesha2.wsrm package

Posted by Chamikara Jayalath <ch...@gmail.com>.
Done. Thanx Sanka

Chamikara


On 8/26/05, Sanka Samaranayake <ss...@gmail.com> wrote:
> Dear Sandesha Committers,
> 
> It seems that there are few errors in the classes in
> org.apache.sandesha2.wsrm package concerning the methods
> fromSOAPEnvelope(), toSOAPEnvelope().
> 
> Please accept the patch I've included which will resolve those errors.
> 
> Thanks,
> Sanka Samaranayake
> 
> 
> 
> Index: wsrm/SequenceAcknowledgement.java
> ===================================================================
> --- wsrm/SequenceAcknowledgement.java   (revision 240164)
> +++ wsrm/SequenceAcknowledgement.java   (working copy)
> @@ -24,6 +24,7 @@
>  import org.apache.axis2.om.OMElement;
>  import org.apache.axis2.om.OMException;
>  import org.apache.axis2.om.OMNamespace;
> +import org.apache.axis2.om.OMNode;
>  import org.apache.axis2.soap.SOAPEnvelope;
>  import org.apache.axis2.soap.SOAPHeader;
>  import org.apache.axis2.soap.SOAPHeaderBlock;
> @@ -69,21 +70,36 @@
>                 SOAPHeader soapHeader = envelope.getHeader();
>                 Iterator iterator = soapHeader.getChildren();
>                 while (iterator.hasNext()){
> -                       OMElement omElement = (OMElement)iterator.next();
> +                       OMNode omNode = (OMNode) iterator.next();
> +
> +                       if (!(omNode instanceof OMElement)) {
> +                               continue;
> +                       }
> +                       OMElement omElement = (OMElement) omNode;
> +
>                         if (omElement.getLocalName().equals(Constants.WSRM.SEQUENCE_ACK)){
>                                 Iterator childIterator = omElement.getChildren();
>                                 while (childIterator.hasNext()){
> -                                       OMElement childElement = (OMElement)childIterator.next();
> +                                       OMNode childOMNode = (OMNode) childIterator.next();
> +
> +                                       if (!(childOMNode instanceof OMElement)) {
> +                                               continue;
> +                                       }
> +
> +                                       OMElement childElement = (OMElement) childOMNode;
> +
>                                         if (childElement.getLocalName().equals(Constants.WSRM.ACK_RANGE)){
>                                                 AcknowledgementRange ackRange = new AcknowledgementRange();
>                                                 ackRange.fromSOAPEnvelope(childElement);
>                                                 acknowledgementRanges.add(ackRange);
>                                         }
> +
>                                         if (childElement.getLocalName().equals(Constants.WSRM.NACK)){
>                                                 Nack nack = new Nack();
>                                                 nack.fromSOAPEnvelope(childElement);
>                                                 nackList.add(nack);
>                                         }
> +
>                                         if ( childElement.getLocalName().equals(Constants.WSRM.IDENTIFIER)){
>                                                 identifier = new Identifier();
>                                                 identifier.fromSOAPEnvelope(envelope);
> Index: wsrm/CreateSequenceResponse.java
> ===================================================================
> --- wsrm/CreateSequenceResponse.java    (revision 240164)
> +++ wsrm/CreateSequenceResponse.java    (working copy)
> @@ -71,6 +71,7 @@
>         public Identifier getIdentifier(){
>                 return identifier;
>         }
> +
>         public void setAccept(Accept accept){
>                 this.accept = accept;
>         }
> Index: wsrm/Identifier.java
> ===================================================================
> --- wsrm/Identifier.java        (revision 240164)
> +++ wsrm/Identifier.java        (working copy)
> @@ -44,10 +44,6 @@
>                                 Constants.WSRM.IDENTIFIER, wsuNamespace);
>         }
> 
> -       public void setURI(String uri) throws OMException {
> -               identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(uri));
> -       }
> -
>         public void setIndentifer(String identifier) {
>                 this.identifier = identifier;
>         }
> @@ -89,7 +85,7 @@
>                         throws OMException {
>                 //soapheaderblock will be given or anyother block reference to the requirment
>                 if (identifier == null || identifier == "") {
> -                       throw new OMException("Set Identifier");
> +                       throw new OMException("identifier is not set .. ");
>                 }
>                 identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
>                                 identifier));
> Index: wsrm/AcksTo.java
> ===================================================================
> --- wsrm/AcksTo.java    (revision 240164)
> +++ wsrm/AcksTo.java    (working copy)
> @@ -18,6 +18,9 @@
> 
>  import java.util.Iterator;
> 
> +import javax.xml.namespace.QName;
> +
> +import org.apache.axis2.addressing.AddressingConstants;
>  import org.apache.axis2.addressing.EndpointReference;
>  import org.apache.axis2.om.OMAbstractFactory;
>  import org.apache.axis2.om.OMElement;
> @@ -57,7 +60,9 @@
>                         }else{
>                                 OMElement omElement = (OMElement)omNode;
>                                 if (omElement.getLocalName().equals(Constants.WSRM.ACKS_TO)){
> -                                       String uri = omElement.getText();
> +                                       OMElement addressElement = omElement.getFirstChildWithName(
> +                                                       new QName(AddressingConstants.EPR_ADDRESS));
> +                                       String uri = addressElement.getText();
>                                         EPR = new EndpointReference(uri);
>                                         return true;
>                                 }else{
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Re: [Patch] errors in org.apache.sandesha2.wsrm package

Posted by Chamikara Jayalath <ch...@gmail.com>.
Done. Thanx Sanka

Chamikara


On 8/26/05, Sanka Samaranayake <ss...@gmail.com> wrote:
> Dear Sandesha Committers,
> 
> It seems that there are few errors in the classes in
> org.apache.sandesha2.wsrm package concerning the methods
> fromSOAPEnvelope(), toSOAPEnvelope().
> 
> Please accept the patch I've included which will resolve those errors.
> 
> Thanks,
> Sanka Samaranayake
> 
> 
> 
> Index: wsrm/SequenceAcknowledgement.java
> ===================================================================
> --- wsrm/SequenceAcknowledgement.java   (revision 240164)
> +++ wsrm/SequenceAcknowledgement.java   (working copy)
> @@ -24,6 +24,7 @@
>  import org.apache.axis2.om.OMElement;
>  import org.apache.axis2.om.OMException;
>  import org.apache.axis2.om.OMNamespace;
> +import org.apache.axis2.om.OMNode;
>  import org.apache.axis2.soap.SOAPEnvelope;
>  import org.apache.axis2.soap.SOAPHeader;
>  import org.apache.axis2.soap.SOAPHeaderBlock;
> @@ -69,21 +70,36 @@
>                 SOAPHeader soapHeader = envelope.getHeader();
>                 Iterator iterator = soapHeader.getChildren();
>                 while (iterator.hasNext()){
> -                       OMElement omElement = (OMElement)iterator.next();
> +                       OMNode omNode = (OMNode) iterator.next();
> +
> +                       if (!(omNode instanceof OMElement)) {
> +                               continue;
> +                       }
> +                       OMElement omElement = (OMElement) omNode;
> +
>                         if (omElement.getLocalName().equals(Constants.WSRM.SEQUENCE_ACK)){
>                                 Iterator childIterator = omElement.getChildren();
>                                 while (childIterator.hasNext()){
> -                                       OMElement childElement = (OMElement)childIterator.next();
> +                                       OMNode childOMNode = (OMNode) childIterator.next();
> +
> +                                       if (!(childOMNode instanceof OMElement)) {
> +                                               continue;
> +                                       }
> +
> +                                       OMElement childElement = (OMElement) childOMNode;
> +
>                                         if (childElement.getLocalName().equals(Constants.WSRM.ACK_RANGE)){
>                                                 AcknowledgementRange ackRange = new AcknowledgementRange();
>                                                 ackRange.fromSOAPEnvelope(childElement);
>                                                 acknowledgementRanges.add(ackRange);
>                                         }
> +
>                                         if (childElement.getLocalName().equals(Constants.WSRM.NACK)){
>                                                 Nack nack = new Nack();
>                                                 nack.fromSOAPEnvelope(childElement);
>                                                 nackList.add(nack);
>                                         }
> +
>                                         if ( childElement.getLocalName().equals(Constants.WSRM.IDENTIFIER)){
>                                                 identifier = new Identifier();
>                                                 identifier.fromSOAPEnvelope(envelope);
> Index: wsrm/CreateSequenceResponse.java
> ===================================================================
> --- wsrm/CreateSequenceResponse.java    (revision 240164)
> +++ wsrm/CreateSequenceResponse.java    (working copy)
> @@ -71,6 +71,7 @@
>         public Identifier getIdentifier(){
>                 return identifier;
>         }
> +
>         public void setAccept(Accept accept){
>                 this.accept = accept;
>         }
> Index: wsrm/Identifier.java
> ===================================================================
> --- wsrm/Identifier.java        (revision 240164)
> +++ wsrm/Identifier.java        (working copy)
> @@ -44,10 +44,6 @@
>                                 Constants.WSRM.IDENTIFIER, wsuNamespace);
>         }
> 
> -       public void setURI(String uri) throws OMException {
> -               identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(uri));
> -       }
> -
>         public void setIndentifer(String identifier) {
>                 this.identifier = identifier;
>         }
> @@ -89,7 +85,7 @@
>                         throws OMException {
>                 //soapheaderblock will be given or anyother block reference to the requirment
>                 if (identifier == null || identifier == "") {
> -                       throw new OMException("Set Identifier");
> +                       throw new OMException("identifier is not set .. ");
>                 }
>                 identifierElement.addChild(OMAbstractFactory.getSOAP11Factory().createText(
>                                 identifier));
> Index: wsrm/AcksTo.java
> ===================================================================
> --- wsrm/AcksTo.java    (revision 240164)
> +++ wsrm/AcksTo.java    (working copy)
> @@ -18,6 +18,9 @@
> 
>  import java.util.Iterator;
> 
> +import javax.xml.namespace.QName;
> +
> +import org.apache.axis2.addressing.AddressingConstants;
>  import org.apache.axis2.addressing.EndpointReference;
>  import org.apache.axis2.om.OMAbstractFactory;
>  import org.apache.axis2.om.OMElement;
> @@ -57,7 +60,9 @@
>                         }else{
>                                 OMElement omElement = (OMElement)omNode;
>                                 if (omElement.getLocalName().equals(Constants.WSRM.ACKS_TO)){
> -                                       String uri = omElement.getText();
> +                                       OMElement addressElement = omElement.getFirstChildWithName(
> +                                                       new QName(AddressingConstants.EPR_ADDRESS));
> +                                       String uri = addressElement.getText();
>                                         EPR = new EndpointReference(uri);
>                                         return true;
>                                 }else{
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org