You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Scott Nichol <sn...@scottnichol.com> on 2002/07/10 00:09:46 UTC

Re: Help:Extracting the name of elements in user-defined provider

The Envelope gives you access to Body through Envelope#getBody.

Scott Nichol

----- Original Message ----- 
From: "Eric Lo" <ec...@csis.hku.hk>
To: <so...@xml.apache.org>
Sent: Tuesday, July 09, 2002 8:54 PM
Subject: Help:Extracting the name of elements in user-defined provider


> Hi,
> I am writing my own provider by implementing the Provider interface.  I 
> also need to pass the element names in the SOAP message into the 
> invoking method.
> 
> For example, the incoming soap message is:
> ...
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="...>
> <SOAP-ENV:Body>
>   <ns1:methodname xmlns:ns1="....
>   <model xsi:type="xsd:string">065-1439</model>
>   <total_qty xsi:type=="xsd:string">1000</model>
>   </ns1:methodname>
>   </SOAP-ENV:Body>
> </SOAP-EVN:Envelope>
> 
> And I need the pass the element name, such as ("model" and "total") into 
> the method.  However, as I need to implement the provider interface, I 
> cannot access the Class "Body" (as I must conform to the locate and 
> invoke method which do not have "Body" class).  How can I do this?
> 
> Thanks!
> Eric
> 
> public void locate( DeploymentDescriptor dd,
>                          Envelope env,
>                          Call call,
>                          String methodName,
>                          String targetObjectURI,
>                          SOAPContext reqContext )
> 
> public void invoke(SOAPContext reqContext, SOAPContext resContext)
>                 throws SOAPException{
> 
> //Invoke my custom method, pass the element names (such as model and 
> total_qty) down
> 
> }
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 
> 


Re: Help:Extracting the name of elements in user-defined provider

Posted by Scott Nichol <sn...@scottnichol.com>.
Eric,

To do custom SOAP work, you should expect to read a lot of the source.

If you look at Body.java, you will see that it contains a Vector named
bodyEntries that you can get with the getBodyEntries method.  Further,
looking at the unmarshal method, you that each element of the Vector is
simply a DOM Element that is a child of the <Body> element.  This is how you
can access the received body.

Scott Nichol

----- Original Message -----
From: "Eric Lo" <ec...@csis.hku.hk>
To: <so...@xml.apache.org>
Sent: Wednesday, July 10, 2002 7:35 PM
Subject: Re: Help:Extracting the name of elements in user-defined provider


> Oh thanks a lot,
> But I seems so unlucky that even the Body class does not encapsulate any
> information on the child element inside <SOAP-ENV:Body> (e.g. model,
> total_qty) at all!  Because when I try to print out the body content by
>
> System.out.println(envelope.getBody().toString());
>
> I got the following output(which seems the body object didn't store the
> element name "model" and "total_qty" in any fashion:
> ---------------------------------------------------------
> [Attributes={}] [BodyEntries=
> [(0)=[ns1:methodname: null]]
> ]
> ---------------------------------------------------------
> The incoming soap message from Tcp tunnel is like this:
>  >><SOAP-ENV:Body>
>  >>  <ns1:methodname xmlns:ns1="....
>  >>  <model xsi:type="xsd:string">065-1439</model>
>  >>  <total_qty xsi:type=="xsd:string">1000</model>
>  >>  </ns1:methodname>
>  >>  </SOAP-ENV:Body>
>
> ---------------------------------------------------------
>
> Thanks for any suggestion!
>
> Eric
>
>
>
> Scott Nichol wrote:
>
> > The Envelope gives you access to Body through Envelope#getBody.
> >
> > Scott Nichol
> >
> > ----- Original Message -----
> > From: "Eric Lo" <ec...@csis.hku.hk>
> > To: <so...@xml.apache.org>
> > Sent: Tuesday, July 09, 2002 8:54 PM
> > Subject: Help:Extracting the name of elements in user-defined provider
> >
> >
> >
> >>Hi,
> >>I am writing my own provider by implementing the Provider interface.  I
> >>also need to pass the element names in the SOAP message into the
> >>invoking method.
> >>
> >>For example, the incoming soap message is:
> >>...
> >><SOAP-ENV:Envelope xmlns:SOAP-ENV="...>
> >><SOAP-ENV:Body>
> >>  <ns1:methodname xmlns:ns1="....
> >>  <model xsi:type="xsd:string">065-1439</model>
> >>  <total_qty xsi:type=="xsd:string">1000</model>
> >>  </ns1:methodname>
> >>  </SOAP-ENV:Body>
> >></SOAP-EVN:Envelope>
> >>
> >>And I need the pass the element name, such as ("model" and "total") into
> >>the method.  However, as I need to implement the provider interface, I
> >>cannot access the Class "Body" (as I must conform to the locate and
> >>invoke method which do not have "Body" class).  How can I do this?
> >>
> >>Thanks!
> >>Eric
> >>
> >>public void locate( DeploymentDescriptor dd,
> >>                         Envelope env,
> >>                         Call call,
> >>                         String methodName,
> >>                         String targetObjectURI,
> >>                         SOAPContext reqContext )
> >>
> >>public void invoke(SOAPContext reqContext, SOAPContext resContext)
> >>                throws SOAPException{
> >>
> >>//Invoke my custom method, pass the element names (such as model and
> >>total_qty) down
> >>
> >>}
> >>
> >>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


Re: Help:Extracting the name of elements in user-defined provider

Posted by Scott Nichol <sn...@scottnichol.com>.
Eric,

To do custom SOAP work, you should expect to read a lot of the source.

If you look at Body.java, you will see that it contains a Vector named
bodyEntries that you can get with the getBodyEntries method.  Further,
looking at the unmarshal method, you that each element of the Vector is
simply a DOM Element that is a child of the <Body> element.  This is how you
can access the received body.

Scott Nichol

----- Original Message -----
From: "Eric Lo" <ec...@csis.hku.hk>
To: <so...@xml.apache.org>
Sent: Wednesday, July 10, 2002 7:35 PM
Subject: Re: Help:Extracting the name of elements in user-defined provider


> Oh thanks a lot,
> But I seems so unlucky that even the Body class does not encapsulate any
> information on the child element inside <SOAP-ENV:Body> (e.g. model,
> total_qty) at all!  Because when I try to print out the body content by
>
> System.out.println(envelope.getBody().toString());
>
> I got the following output(which seems the body object didn't store the
> element name "model" and "total_qty" in any fashion:
> ---------------------------------------------------------
> [Attributes={}] [BodyEntries=
> [(0)=[ns1:methodname: null]]
> ]
> ---------------------------------------------------------
> The incoming soap message from Tcp tunnel is like this:
>  >><SOAP-ENV:Body>
>  >>  <ns1:methodname xmlns:ns1="....
>  >>  <model xsi:type="xsd:string">065-1439</model>
>  >>  <total_qty xsi:type=="xsd:string">1000</model>
>  >>  </ns1:methodname>
>  >>  </SOAP-ENV:Body>
>
> ---------------------------------------------------------
>
> Thanks for any suggestion!
>
> Eric
>
>
>
> Scott Nichol wrote:
>
> > The Envelope gives you access to Body through Envelope#getBody.
> >
> > Scott Nichol
> >
> > ----- Original Message -----
> > From: "Eric Lo" <ec...@csis.hku.hk>
> > To: <so...@xml.apache.org>
> > Sent: Tuesday, July 09, 2002 8:54 PM
> > Subject: Help:Extracting the name of elements in user-defined provider
> >
> >
> >
> >>Hi,
> >>I am writing my own provider by implementing the Provider interface.  I
> >>also need to pass the element names in the SOAP message into the
> >>invoking method.
> >>
> >>For example, the incoming soap message is:
> >>...
> >><SOAP-ENV:Envelope xmlns:SOAP-ENV="...>
> >><SOAP-ENV:Body>
> >>  <ns1:methodname xmlns:ns1="....
> >>  <model xsi:type="xsd:string">065-1439</model>
> >>  <total_qty xsi:type=="xsd:string">1000</model>
> >>  </ns1:methodname>
> >>  </SOAP-ENV:Body>
> >></SOAP-EVN:Envelope>
> >>
> >>And I need the pass the element name, such as ("model" and "total") into
> >>the method.  However, as I need to implement the provider interface, I
> >>cannot access the Class "Body" (as I must conform to the locate and
> >>invoke method which do not have "Body" class).  How can I do this?
> >>
> >>Thanks!
> >>Eric
> >>
> >>public void locate( DeploymentDescriptor dd,
> >>                         Envelope env,
> >>                         Call call,
> >>                         String methodName,
> >>                         String targetObjectURI,
> >>                         SOAPContext reqContext )
> >>
> >>public void invoke(SOAPContext reqContext, SOAPContext resContext)
> >>                throws SOAPException{
> >>
> >>//Invoke my custom method, pass the element names (such as model and
> >>total_qty) down
> >>
> >>}
> >>
> >>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: Help:Extracting the name of elements in user-defined provider

Posted by Eric Lo <ec...@csis.hku.hk>.
Oh thanks a lot,
	But I seems so unlucky that even the Body class does not encapsulate any 
information on the child element inside <SOAP-ENV:Body> (e.g. model, 
total_qty) at all!  Because when I try to print out the body content by

System.out.println(envelope.getBody().toString());

I got the following output(which seems the body object didn't store the 
element name "model" and "total_qty" in any fashion:
---------------------------------------------------------
[Attributes={}] [BodyEntries=
[(0)=[ns1:methodname: null]]
]
---------------------------------------------------------
The incoming soap message from Tcp tunnel is like this:
 >><SOAP-ENV:Body>
 >>  <ns1:methodname xmlns:ns1="....
 >>  <model xsi:type="xsd:string">065-1439</model>
 >>  <total_qty xsi:type=="xsd:string">1000</model>
 >>  </ns1:methodname>
 >>  </SOAP-ENV:Body>

---------------------------------------------------------

Thanks for any suggestion!

Eric



Scott Nichol wrote:

> The Envelope gives you access to Body through Envelope#getBody.
> 
> Scott Nichol
> 
> ----- Original Message ----- 
> From: "Eric Lo" <ec...@csis.hku.hk>
> To: <so...@xml.apache.org>
> Sent: Tuesday, July 09, 2002 8:54 PM
> Subject: Help:Extracting the name of elements in user-defined provider
> 
> 
> 
>>Hi,
>>I am writing my own provider by implementing the Provider interface.  I 
>>also need to pass the element names in the SOAP message into the 
>>invoking method.
>>
>>For example, the incoming soap message is:
>>...
>><SOAP-ENV:Envelope xmlns:SOAP-ENV="...>
>><SOAP-ENV:Body>
>>  <ns1:methodname xmlns:ns1="....
>>  <model xsi:type="xsd:string">065-1439</model>
>>  <total_qty xsi:type=="xsd:string">1000</model>
>>  </ns1:methodname>
>>  </SOAP-ENV:Body>
>></SOAP-EVN:Envelope>
>>
>>And I need the pass the element name, such as ("model" and "total") into 
>>the method.  However, as I need to implement the provider interface, I 
>>cannot access the Class "Body" (as I must conform to the locate and 
>>invoke method which do not have "Body" class).  How can I do this?
>>
>>Thanks!
>>Eric
>>
>>public void locate( DeploymentDescriptor dd,
>>                         Envelope env,
>>                         Call call,
>>                         String methodName,
>>                         String targetObjectURI,
>>                         SOAPContext reqContext )
>>
>>public void invoke(SOAPContext reqContext, SOAPContext resContext)
>>                throws SOAPException{
>>
>>//Invoke my custom method, pass the element names (such as model and 
>>total_qty) down
>>
>>}
>>
>>



Re: Help:Extracting the name of elements in user-defined provider

Posted by Eric Lo <ec...@csis.hku.hk>.
Oh thanks a lot,
	But I seems so unlucky that even the Body class does not encapsulate any 
information on the child element inside <SOAP-ENV:Body> (e.g. model, 
total_qty) at all!  Because when I try to print out the body content by

System.out.println(envelope.getBody().toString());

I got the following output(which seems the body object didn't store the 
element name "model" and "total_qty" in any fashion:
---------------------------------------------------------
[Attributes={}] [BodyEntries=
[(0)=[ns1:methodname: null]]
]
---------------------------------------------------------
The incoming soap message from Tcp tunnel is like this:
 >><SOAP-ENV:Body>
 >>  <ns1:methodname xmlns:ns1="....
 >>  <model xsi:type="xsd:string">065-1439</model>
 >>  <total_qty xsi:type=="xsd:string">1000</model>
 >>  </ns1:methodname>
 >>  </SOAP-ENV:Body>

---------------------------------------------------------

Thanks for any suggestion!

Eric



Scott Nichol wrote:

> The Envelope gives you access to Body through Envelope#getBody.
> 
> Scott Nichol
> 
> ----- Original Message ----- 
> From: "Eric Lo" <ec...@csis.hku.hk>
> To: <so...@xml.apache.org>
> Sent: Tuesday, July 09, 2002 8:54 PM
> Subject: Help:Extracting the name of elements in user-defined provider
> 
> 
> 
>>Hi,
>>I am writing my own provider by implementing the Provider interface.  I 
>>also need to pass the element names in the SOAP message into the 
>>invoking method.
>>
>>For example, the incoming soap message is:
>>...
>><SOAP-ENV:Envelope xmlns:SOAP-ENV="...>
>><SOAP-ENV:Body>
>>  <ns1:methodname xmlns:ns1="....
>>  <model xsi:type="xsd:string">065-1439</model>
>>  <total_qty xsi:type=="xsd:string">1000</model>
>>  </ns1:methodname>
>>  </SOAP-ENV:Body>
>></SOAP-EVN:Envelope>
>>
>>And I need the pass the element name, such as ("model" and "total") into 
>>the method.  However, as I need to implement the provider interface, I 
>>cannot access the Class "Body" (as I must conform to the locate and 
>>invoke method which do not have "Body" class).  How can I do this?
>>
>>Thanks!
>>Eric
>>
>>public void locate( DeploymentDescriptor dd,
>>                         Envelope env,
>>                         Call call,
>>                         String methodName,
>>                         String targetObjectURI,
>>                         SOAPContext reqContext )
>>
>>public void invoke(SOAPContext reqContext, SOAPContext resContext)
>>                throws SOAPException{
>>
>>//Invoke my custom method, pass the element names (such as model and 
>>total_qty) down
>>
>>}
>>
>>



--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>