You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by bo...@nac.net on 2001/04/02 19:03:57 UTC
View messages online
Is there a way to view, search previous questions and response through
browser? Is so, where can I point to. I am having trouble with SOAP 2.1
and I believe others may have run into same problem. I'd like to see if my
problem has been answered prior to posting a question.
Thanks.
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Re: Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by Wouter Cloetens <wo...@mind.be>.
On Mon, Apr 02, 2001 at 03:53:21PM -0400, Wei Qian wrote:
> Here is what i did in MessageRoouterServlet.jave, after getting the envolope
> from the request. You should be able to get the body in a similar fashion.
>
> Envelope msgEnv =
> ServerHTTPUtils.readEnvelopeFromRequest(xpl,
> req.getContentType(),
> req.getContentLength(),
> req.getInputStream(),
> editor, res, reqCtx);
I'd like to point out that a server-side method implementing a messaging
request, is already passed the Envelope object. So you don't need to do
the above. What follows below is indeed a useful example on how to extract
the Header and Body objects from the Envelope object.
> // get the namespace URI and and localpart of the first child
> // element of the body of the envelope
> Body body = msgEnv.getBody ();
>
> Element eBody = (Element) body.getBodyEntries().elementAt (0);
> if (eBody == null) {
> res.sendError (res.SC_BAD_REQUEST, "Element's body is empty!");
> }
>
> StringWriter swBody = new StringWriter();
> Utils.marshallNode(eBody, swBody);
> System.err.println("SOAP body = " + swBody.toString());
>
>
> // handle header
> // Inside header, we have all DSRequest headers there,
> // The most importment one is DServiceID
> String szDServiceID = null;
>
> Header header = msgEnv.getHeader();
>
> Element eHeader = (Element) header.getHeaderEntries().elementAt (0);
> StringWriter swHeader = new StringWriter();
> Utils.marshallNode(eHeader, swHeader);
> System.err.println("Header = " + swHeader.toString());
>
> String headerName = eHeader.getLocalName();
> String headerValue = eHeader.getNodeValue();
> if (eHeader.hasChildNodes()) {
> Node eChild = eHeader.getFirstChild();
> headerValue = eChild.getNodeValue();
> System.err.println("header name = " + headerName + ", value = " +
> headerValue);
> }
>
>
> Cheers,
>
> -Wei
> ----- Original Message -----
> From: "William Leung" <wl...@nortelnetworks.com>
> To: <so...@xml.apache.org>
> Sent: Monday, April 02, 2001 2:32 PM
> Subject: Example of retrieving SOAP Body at the MessageRouter POProcessor
>
>
> > Hi,
> >
> > Can anyone please kindly show me a very simple example on how to retrieve
> the
> > SOAP Body at the purchaseOrder method (messaging sample) at the server
> side??
> >
> > public class POProcessor {
> > public void purchaseOrder (Envelope env, SOAPContext reqCtx,
> > SOAPContext resCtx)
> > throws MessagingException, IOException {
> >
> > /*
> > Code to retrieve the XML message sent from Client
> > */
> >
> > System.out.println(reqCtx.toString());
> > resCtx.setRootPart("OK thanks, got the PO; we'll contact you when
> ready.",
> > "text/xml");
> > }
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
---end quoted text---
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Re: Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by Wouter Cloetens <wo...@mind.be>.
On Mon, Apr 02, 2001 at 03:53:21PM -0400, Wei Qian wrote:
> Here is what i did in MessageRoouterServlet.jave, after getting the envolope
> from the request. You should be able to get the body in a similar fashion.
>
> Envelope msgEnv =
> ServerHTTPUtils.readEnvelopeFromRequest(xpl,
> req.getContentType(),
> req.getContentLength(),
> req.getInputStream(),
> editor, res, reqCtx);
I'd like to point out that a server-side method implementing a messaging
request, is already passed the Envelope object. So you don't need to do
the above. What follows below is indeed a useful example on how to extract
the Header and Body objects from the Envelope object.
> // get the namespace URI and and localpart of the first child
> // element of the body of the envelope
> Body body = msgEnv.getBody ();
>
> Element eBody = (Element) body.getBodyEntries().elementAt (0);
> if (eBody == null) {
> res.sendError (res.SC_BAD_REQUEST, "Element's body is empty!");
> }
>
> StringWriter swBody = new StringWriter();
> Utils.marshallNode(eBody, swBody);
> System.err.println("SOAP body = " + swBody.toString());
>
>
> // handle header
> // Inside header, we have all DSRequest headers there,
> // The most importment one is DServiceID
> String szDServiceID = null;
>
> Header header = msgEnv.getHeader();
>
> Element eHeader = (Element) header.getHeaderEntries().elementAt (0);
> StringWriter swHeader = new StringWriter();
> Utils.marshallNode(eHeader, swHeader);
> System.err.println("Header = " + swHeader.toString());
>
> String headerName = eHeader.getLocalName();
> String headerValue = eHeader.getNodeValue();
> if (eHeader.hasChildNodes()) {
> Node eChild = eHeader.getFirstChild();
> headerValue = eChild.getNodeValue();
> System.err.println("header name = " + headerName + ", value = " +
> headerValue);
> }
>
>
> Cheers,
>
> -Wei
> ----- Original Message -----
> From: "William Leung" <wl...@nortelnetworks.com>
> To: <so...@xml.apache.org>
> Sent: Monday, April 02, 2001 2:32 PM
> Subject: Example of retrieving SOAP Body at the MessageRouter POProcessor
>
>
> > Hi,
> >
> > Can anyone please kindly show me a very simple example on how to retrieve
> the
> > SOAP Body at the purchaseOrder method (messaging sample) at the server
> side??
> >
> > public class POProcessor {
> > public void purchaseOrder (Envelope env, SOAPContext reqCtx,
> > SOAPContext resCtx)
> > throws MessagingException, IOException {
> >
> > /*
> > Code to retrieve the XML message sent from Client
> > */
> >
> > System.out.println(reqCtx.toString());
> > resCtx.setRootPart("OK thanks, got the PO; we'll contact you when
> ready.",
> > "text/xml");
> > }
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
---end quoted text---
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
RE: Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by Wei Qian <We...@oracle.com>.
Here is the post.
-Wei
-----Original Message-----
From: Wei Qian [mailto:Wei.Qian@oracle.com]
Sent: Monday, April 02, 2001 3:53 PM
To: soap-user@xml.apache.org; William Leung
Subject: Re: Example of retrieving SOAP Body at the MessageRouter
POProcessor
Hi,
Here is what i did in MessageRoouterServlet.jave, after getting the envolope
from the request. You should be able to get the body in a similar fashion.
Envelope msgEnv =
ServerHTTPUtils.readEnvelopeFromRequest(xpl,
req.getContentType(),
req.getContentLength(),
req.getInputStream(),
editor, res, reqCtx);
// get the namespace URI and and localpart of the first child
// element of the body of the envelope
Body body = msgEnv.getBody ();
Element eBody = (Element) body.getBodyEntries().elementAt (0);
if (eBody == null) {
res.sendError (res.SC_BAD_REQUEST, "Element's body is empty!");
}
StringWriter swBody = new StringWriter();
Utils.marshallNode(eBody, swBody);
System.err.println("SOAP body = " + swBody.toString());
// handle header
Header header = msgEnv.getHeader();
Element eHeader = (Element) header.getHeaderEntries().elementAt (0);
StringWriter swHeader = new StringWriter();
Utils.marshallNode(eHeader, swHeader);
System.err.println("Header = " + swHeader.toString());
String headerName = eHeader.getLocalName();
String headerValue = eHeader.getNodeValue();
if (eHeader.hasChildNodes()) {
Node eChild = eHeader.getFirstChild();
headerValue = eChild.getNodeValue();
System.err.println("header name = " + headerName + ", value = " +
headerValue);
}
Cheers,
-Wei
----- Original Message -----
From: "William Leung" <wl...@nortelnetworks.com>
To: <so...@xml.apache.org>
Sent: Monday, April 02, 2001 2:32 PM
Subject: Example of retrieving SOAP Body at the MessageRouter POProcessor
> Hi,
>
> Can anyone please kindly show me a very simple example on how to retrieve
the
> SOAP Body at the purchaseOrder method (messaging sample) at the server
side??
>
> public class POProcessor {
> public void purchaseOrder (Envelope env, SOAPContext reqCtx,
> SOAPContext resCtx)
> throws MessagingException, IOException {
>
> /*
> Code to retrieve the XML message sent from Client
> */
>
> System.out.println(reqCtx.toString());
> resCtx.setRootPart("OK thanks, got the PO; we'll contact you when
ready.",
> "text/xml");
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
RE: Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by Wei Qian <We...@oracle.com>.
Here is the post.
-Wei
-----Original Message-----
From: Wei Qian [mailto:Wei.Qian@oracle.com]
Sent: Monday, April 02, 2001 3:53 PM
To: soap-user@xml.apache.org; William Leung
Subject: Re: Example of retrieving SOAP Body at the MessageRouter
POProcessor
Hi,
Here is what i did in MessageRoouterServlet.jave, after getting the envolope
from the request. You should be able to get the body in a similar fashion.
Envelope msgEnv =
ServerHTTPUtils.readEnvelopeFromRequest(xpl,
req.getContentType(),
req.getContentLength(),
req.getInputStream(),
editor, res, reqCtx);
// get the namespace URI and and localpart of the first child
// element of the body of the envelope
Body body = msgEnv.getBody ();
Element eBody = (Element) body.getBodyEntries().elementAt (0);
if (eBody == null) {
res.sendError (res.SC_BAD_REQUEST, "Element's body is empty!");
}
StringWriter swBody = new StringWriter();
Utils.marshallNode(eBody, swBody);
System.err.println("SOAP body = " + swBody.toString());
// handle header
Header header = msgEnv.getHeader();
Element eHeader = (Element) header.getHeaderEntries().elementAt (0);
StringWriter swHeader = new StringWriter();
Utils.marshallNode(eHeader, swHeader);
System.err.println("Header = " + swHeader.toString());
String headerName = eHeader.getLocalName();
String headerValue = eHeader.getNodeValue();
if (eHeader.hasChildNodes()) {
Node eChild = eHeader.getFirstChild();
headerValue = eChild.getNodeValue();
System.err.println("header name = " + headerName + ", value = " +
headerValue);
}
Cheers,
-Wei
----- Original Message -----
From: "William Leung" <wl...@nortelnetworks.com>
To: <so...@xml.apache.org>
Sent: Monday, April 02, 2001 2:32 PM
Subject: Example of retrieving SOAP Body at the MessageRouter POProcessor
> Hi,
>
> Can anyone please kindly show me a very simple example on how to retrieve
the
> SOAP Body at the purchaseOrder method (messaging sample) at the server
side??
>
> public class POProcessor {
> public void purchaseOrder (Envelope env, SOAPContext reqCtx,
> SOAPContext resCtx)
> throws MessagingException, IOException {
>
> /*
> Code to retrieve the XML message sent from Client
> */
>
> System.out.println(reqCtx.toString());
> resCtx.setRootPart("OK thanks, got the PO; we'll contact you when
ready.",
> "text/xml");
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Re: Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by Wei Qian <We...@oracle.com>.
Hi,
Here is what i did in MessageRoouterServlet.jave, after getting the envolope
from the request. You should be able to get the body in a similar fashion.
Envelope msgEnv =
ServerHTTPUtils.readEnvelopeFromRequest(xpl,
req.getContentType(),
req.getContentLength(),
req.getInputStream(),
editor, res, reqCtx);
// get the namespace URI and and localpart of the first child
// element of the body of the envelope
Body body = msgEnv.getBody ();
Element eBody = (Element) body.getBodyEntries().elementAt (0);
if (eBody == null) {
res.sendError (res.SC_BAD_REQUEST, "Element's body is empty!");
}
StringWriter swBody = new StringWriter();
Utils.marshallNode(eBody, swBody);
System.err.println("SOAP body = " + swBody.toString());
// handle header
// Inside header, we have all DSRequest headers there,
// The most importment one is DServiceID
String szDServiceID = null;
Header header = msgEnv.getHeader();
Element eHeader = (Element) header.getHeaderEntries().elementAt (0);
StringWriter swHeader = new StringWriter();
Utils.marshallNode(eHeader, swHeader);
System.err.println("Header = " + swHeader.toString());
String headerName = eHeader.getLocalName();
String headerValue = eHeader.getNodeValue();
if (eHeader.hasChildNodes()) {
Node eChild = eHeader.getFirstChild();
headerValue = eChild.getNodeValue();
System.err.println("header name = " + headerName + ", value = " +
headerValue);
}
Cheers,
-Wei
----- Original Message -----
From: "William Leung" <wl...@nortelnetworks.com>
To: <so...@xml.apache.org>
Sent: Monday, April 02, 2001 2:32 PM
Subject: Example of retrieving SOAP Body at the MessageRouter POProcessor
> Hi,
>
> Can anyone please kindly show me a very simple example on how to retrieve
the
> SOAP Body at the purchaseOrder method (messaging sample) at the server
side??
>
> public class POProcessor {
> public void purchaseOrder (Envelope env, SOAPContext reqCtx,
> SOAPContext resCtx)
> throws MessagingException, IOException {
>
> /*
> Code to retrieve the XML message sent from Client
> */
>
> System.out.println(reqCtx.toString());
> resCtx.setRootPart("OK thanks, got the PO; we'll contact you when
ready.",
> "text/xml");
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Re: Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by Wei Qian <We...@oracle.com>.
Hi,
Here is what i did in MessageRoouterServlet.jave, after getting the envolope
from the request. You should be able to get the body in a similar fashion.
Envelope msgEnv =
ServerHTTPUtils.readEnvelopeFromRequest(xpl,
req.getContentType(),
req.getContentLength(),
req.getInputStream(),
editor, res, reqCtx);
// get the namespace URI and and localpart of the first child
// element of the body of the envelope
Body body = msgEnv.getBody ();
Element eBody = (Element) body.getBodyEntries().elementAt (0);
if (eBody == null) {
res.sendError (res.SC_BAD_REQUEST, "Element's body is empty!");
}
StringWriter swBody = new StringWriter();
Utils.marshallNode(eBody, swBody);
System.err.println("SOAP body = " + swBody.toString());
// handle header
// Inside header, we have all DSRequest headers there,
// The most importment one is DServiceID
String szDServiceID = null;
Header header = msgEnv.getHeader();
Element eHeader = (Element) header.getHeaderEntries().elementAt (0);
StringWriter swHeader = new StringWriter();
Utils.marshallNode(eHeader, swHeader);
System.err.println("Header = " + swHeader.toString());
String headerName = eHeader.getLocalName();
String headerValue = eHeader.getNodeValue();
if (eHeader.hasChildNodes()) {
Node eChild = eHeader.getFirstChild();
headerValue = eChild.getNodeValue();
System.err.println("header name = " + headerName + ", value = " +
headerValue);
}
Cheers,
-Wei
----- Original Message -----
From: "William Leung" <wl...@nortelnetworks.com>
To: <so...@xml.apache.org>
Sent: Monday, April 02, 2001 2:32 PM
Subject: Example of retrieving SOAP Body at the MessageRouter POProcessor
> Hi,
>
> Can anyone please kindly show me a very simple example on how to retrieve
the
> SOAP Body at the purchaseOrder method (messaging sample) at the server
side??
>
> public class POProcessor {
> public void purchaseOrder (Envelope env, SOAPContext reqCtx,
> SOAPContext resCtx)
> throws MessagingException, IOException {
>
> /*
> Code to retrieve the XML message sent from Client
> */
>
> System.out.println(reqCtx.toString());
> resCtx.setRootPart("OK thanks, got the PO; we'll contact you when
ready.",
> "text/xml");
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by William Leung <wl...@nortelnetworks.com>.
Hi,
Can anyone please kindly show me a very simple example on how to retrieve the
SOAP Body at the purchaseOrder method (messaging sample) at the server side??
public class POProcessor {
public void purchaseOrder (Envelope env, SOAPContext reqCtx,
SOAPContext resCtx)
throws MessagingException, IOException {
/*
Code to retrieve the XML message sent from Client
*/
System.out.println(reqCtx.toString());
resCtx.setRootPart("OK thanks, got the PO; we'll contact you when ready.",
"text/xml");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Example of retrieving SOAP Body at the MessageRouter POProcessor
Posted by William Leung <wl...@nortelnetworks.com>.
Hi,
Can anyone please kindly show me a very simple example on how to retrieve the
SOAP Body at the purchaseOrder method (messaging sample) at the server side??
public class POProcessor {
public void purchaseOrder (Envelope env, SOAPContext reqCtx,
SOAPContext resCtx)
throws MessagingException, IOException {
/*
Code to retrieve the XML message sent from Client
*/
System.out.println(reqCtx.toString());
resCtx.setRootPart("OK thanks, got the PO; we'll contact you when ready.",
"text/xml");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org