You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Scott Merritt <SM...@abilizer.com> on 2001/11/06 20:27:18 UTC

RE: Exception? Root element of SOAP message must be:? Confused. .. Help!

You don't by any chance know how to get Apache SOAP 2.2 to print the
request?  I'm looking in the API docs now...

I do know that I'm doing a...

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

And they're expecting...

<?xml version="1.0" encoding="UTF-8" ?> 
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:findProperties xmlns:ns1="urn:RealEstate"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <sell xsi:type="xsd:string">Sell</sell> ...

-----Original Message-----
From: Ian Snead [mailto:isnead@ezgov.com]
Sent: Tuesday, November 06, 2001 11:09 AM
To: soap-user@xml.apache.org
Subject: Re: Exception? Root element of SOAP message must be:?
Confused... Help!


Hello Scott,

Which SOAP implementations are you using 
on the client and the server sides? Could you
post the full text of the request you sent?

I'm not sure how, but it looks as if you have
the element 'Client' in the first node of your
SOAP XML document. The exception is telling you
that, as defined in the namespace


Scott Merritt wrote:
> 
> What does this exception mean?  I've used web services before but this one
> popped up and I'm not sure where I'm going wrong.
> 
> SOAPException= SOAP-ENV:Client, Root element of a SOAP message must be:
> 'http://schemas.xmlsoap.org/soap/envelope/:Envelope'.
> 
> Code snippet...
> 
>      URL url = new URL(
> "http://tamino.demozone.softwareag.com/demozone/realEstate/findProperties"
> );
>      String urn = "urn:RealEstate";
> 
>      Call call = new Call(); // prepare the service invocation
>      call.setTargetObjectURI( urn );
>      call.setMethodName( "findProperties" );
>      call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
>      Vector params = new Vector();
>      params.addElement( new Parameter( "sell", String.class, "Sell", null
)
> );
>      params.addElement( new Parameter( "propertyType", String.class,
> "House", null ) );
>      params.addElement( new Parameter( "city", String.class, "Union City",
> null ) );
>      params.addElement( new Parameter( "lessPrice", String.class, "", null
)
> );
>      call.setParams( params );
> 
>      try
>        {
>        System.out.println( "invoke service\n" + "  URL= " + url + "\n  URN
> =" +
>           urn );
>        Response response = call.invoke( url, "urn:RealEstate" ); // invoke
> the service
> 
> ...

--
Ian Snead
Software Developer
EzGov
Work : 404 836 7957

"Return a buffered reader to receive 
 back the response to whatever was sent to whatever."
 
 - from the Apache SOAP documentation

Re: Exception? Root element of SOAP message must be:? Confused... Help!

Posted by Nicholas Quaine <nq...@soapuser.com>.
> You don't by any chance know how to get Apache SOAP 2.2 to print the
> request?  I'm looking in the API docs now...

if you use the TCP Tunnel you can see the entire conversation and check what
is wrong in the request message
command to launch : java org.apache.soap.util.net.TcpTunnelGui 5555
localhost 8080
where 5555 is the local port the client will send to and localhost:8080 is
where the server is listening

regards,
Nicholas Quaine

Visit http://www.soapuser.com/

nquaine@soapuser.com


----- Original Message -----
From: "Scott Merritt" <SM...@abilizer.com>
To: <so...@xml.apache.org>
Sent: Tuesday, November 06, 2001 8:27 PM
Subject: RE: Exception? Root element of SOAP message must be:? Confused...
Help!


> You don't by any chance know how to get Apache SOAP 2.2 to print the
> request?  I'm looking in the API docs now...
>
> I do know that I'm doing a...
>
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
> And they're expecting...
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <ns1:findProperties xmlns:ns1="urn:RealEstate"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <sell xsi:type="xsd:string">Sell</sell> ...
>
> -----Original Message-----
> From: Ian Snead [mailto:isnead@ezgov.com]
> Sent: Tuesday, November 06, 2001 11:09 AM
> To: soap-user@xml.apache.org
> Subject: Re: Exception? Root element of SOAP message must be:?
> Confused... Help!
>
>
> Hello Scott,
>
> Which SOAP implementations are you using
> on the client and the server sides? Could you
> post the full text of the request you sent?
>
> I'm not sure how, but it looks as if you have
> the element 'Client' in the first node of your
> SOAP XML document. The exception is telling you
> that, as defined in the namespace
>
>
> Scott Merritt wrote:
> >
> > What does this exception mean?  I've used web services before but this
one
> > popped up and I'm not sure where I'm going wrong.
> >
> > SOAPException= SOAP-ENV:Client, Root element of a SOAP message must be:
> > 'http://schemas.xmlsoap.org/soap/envelope/:Envelope'.
> >
> > Code snippet...
> >
> >      URL url = new URL(
> >
"http://tamino.demozone.softwareag.com/demozone/realEstate/findProperties"
> > );
> >      String urn = "urn:RealEstate";
> >
> >      Call call = new Call(); // prepare the service invocation
> >      call.setTargetObjectURI( urn );
> >      call.setMethodName( "findProperties" );
> >      call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
> >      Vector params = new Vector();
> >      params.addElement( new Parameter( "sell", String.class, "Sell",
null
> )
> > );
> >      params.addElement( new Parameter( "propertyType", String.class,
> > "House", null ) );
> >      params.addElement( new Parameter( "city", String.class, "Union
City",
> > null ) );
> >      params.addElement( new Parameter( "lessPrice", String.class, "",
null
> )
> > );
> >      call.setParams( params );
> >
> >      try
> >        {
> >        System.out.println( "invoke service\n" + "  URL= " + url + "\n
URN
> > =" +
> >           urn );
> >        Response response = call.invoke( url, "urn:RealEstate" ); //
invoke
> > the service
> >
> > ...
>
> --
> Ian Snead
> Software Developer
> EzGov
> Work : 404 836 7957
>
> "Return a buffered reader to receive
>  back the response to whatever was sent to whatever."
>
>  - from the Apache SOAP documentation
>


Re: Exception? Root element of SOAP message must be:? Confused... Help!

Posted by Ian Snead <is...@ezgov.com>.
Scott Merritt wrote:
> 
> You don't by any chance know how to get Apache SOAP 2.2 to print the
> request?  I'm looking in the API docs now...

Interesting request; I had that thought myself, but
have not seen it done or seen an obvious method in
the API. Does Axis have this functionality?

Most folk seem to use a proxy to capture the contents
of a request / response.

Here are two that I have found useful :

http://www.pocketsoap.com/tcptrace/pt.asp
http://www.lanw.com/books/javasoap/default.htm

You will need the following code in your client to
direct an HTTP request to the proxy :

---
import org.apache.soap.transport.http.SOAPHTTPConnection;
    
SOAPHTTPConnection scxn = null; // transport object
          
if( debug )
{
     // proxy code
     scxn = new SOAPHTTPConnection();
     scxn.setProxyHost("localhost"); // proxy machine
     scxn.setProxyPort(proxyPort); // int
} // if

// Build the call.
Call call = new Call();
         
if( debug )
{
      call.setSOAPTransport(scxn); // HTTP
} // if
---

...sans the debug probably, and of course you 
still need the rest of what you are doing.

> 
> I do know that I'm doing a...
> 
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> 

That call, as is, seems to set the encodingStyle
element to "http://schemas.xmlsoap.org/soap/encoding/"

Run the request through a proxy and you will see what
I mean. :)

Hope this helps!

> And they're expecting...
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <ns1:findProperties xmlns:ns1="urn:RealEstate"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <sell xsi:type="xsd:string">Sell</sell> ...
> 
> -----Original Message-----
> From: Ian Snead [mailto:isnead@ezgov.com]
> Sent: Tuesday, November 06, 2001 11:09 AM
> To: soap-user@xml.apache.org
> Subject: Re: Exception? Root element of SOAP message must be:?
> Confused... Help!
> 
> Hello Scott,
> 
> Which SOAP implementations are you using
> on the client and the server sides? Could you
> post the full text of the request you sent?
> 
> I'm not sure how, but it looks as if you have
> the element 'Client' in the first node of your
> SOAP XML document. The exception is telling you
> that, as defined in the namespace
> 
> Scott Merritt wrote:
> >
> > What does this exception mean?  I've used web services before but this one
> > popped up and I'm not sure where I'm going wrong.
> >
> > SOAPException= SOAP-ENV:Client, Root element of a SOAP message must be:
> > 'http://schemas.xmlsoap.org/soap/envelope/:Envelope'.
> >
> > Code snippet...
> >
> >      URL url = new URL(
> > "http://tamino.demozone.softwareag.com/demozone/realEstate/findProperties"
> > );
> >      String urn = "urn:RealEstate";
> >
> >      Call call = new Call(); // prepare the service invocation
> >      call.setTargetObjectURI( urn );
> >      call.setMethodName( "findProperties" );
> >      call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
> >      Vector params = new Vector();
> >      params.addElement( new Parameter( "sell", String.class, "Sell", null
> )
> > );
> >      params.addElement( new Parameter( "propertyType", String.class,
> > "House", null ) );
> >      params.addElement( new Parameter( "city", String.class, "Union City",
> > null ) );
> >      params.addElement( new Parameter( "lessPrice", String.class, "", null
> )
> > );
> >      call.setParams( params );
> >
> >      try
> >        {
> >        System.out.println( "invoke service\n" + "  URL= " + url + "\n  URN
> > =" +
> >           urn );
> >        Response response = call.invoke( url, "urn:RealEstate" ); // invoke
> > the service
> >
> > ...
> 
> --
> Ian Snead
> Software Developer
> EzGov
> Work : 404 836 7957
> 
> "Return a buffered reader to receive
>  back the response to whatever was sent to whatever."
> 
>  - from the Apache SOAP documentation

--
Ian Snead
Software Developer
EzGov
Work : 404 836 7957

"Return a buffered reader to receive 
 back the response to whatever was sent to whatever."
 
 - from the Apache SOAP documentation

Re: Exception? Root element of SOAP message must be:? Confused... Help!

Posted by Nicholas Quaine <nq...@soapuser.com>.
> You don't by any chance know how to get Apache SOAP 2.2 to print the
> request?  I'm looking in the API docs now...

if you use the TCP Tunnel you can see the entire conversation and check what
is wrong in the request message
command to launch : java org.apache.soap.util.net.TcpTunnelGui 5555
localhost 8080
where 5555 is the local port the client will send to and localhost:8080 is
where the server is listening

regards,
Nicholas Quaine

Visit http://www.soapuser.com/

nquaine@soapuser.com


----- Original Message -----
From: "Scott Merritt" <SM...@abilizer.com>
To: <so...@xml.apache.org>
Sent: Tuesday, November 06, 2001 8:27 PM
Subject: RE: Exception? Root element of SOAP message must be:? Confused...
Help!


> You don't by any chance know how to get Apache SOAP 2.2 to print the
> request?  I'm looking in the API docs now...
>
> I do know that I'm doing a...
>
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
> And they're expecting...
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <ns1:findProperties xmlns:ns1="urn:RealEstate"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <sell xsi:type="xsd:string">Sell</sell> ...
>
> -----Original Message-----
> From: Ian Snead [mailto:isnead@ezgov.com]
> Sent: Tuesday, November 06, 2001 11:09 AM
> To: soap-user@xml.apache.org
> Subject: Re: Exception? Root element of SOAP message must be:?
> Confused... Help!
>
>
> Hello Scott,
>
> Which SOAP implementations are you using
> on the client and the server sides? Could you
> post the full text of the request you sent?
>
> I'm not sure how, but it looks as if you have
> the element 'Client' in the first node of your
> SOAP XML document. The exception is telling you
> that, as defined in the namespace
>
>
> Scott Merritt wrote:
> >
> > What does this exception mean?  I've used web services before but this
one
> > popped up and I'm not sure where I'm going wrong.
> >
> > SOAPException= SOAP-ENV:Client, Root element of a SOAP message must be:
> > 'http://schemas.xmlsoap.org/soap/envelope/:Envelope'.
> >
> > Code snippet...
> >
> >      URL url = new URL(
> >
"http://tamino.demozone.softwareag.com/demozone/realEstate/findProperties"
> > );
> >      String urn = "urn:RealEstate";
> >
> >      Call call = new Call(); // prepare the service invocation
> >      call.setTargetObjectURI( urn );
> >      call.setMethodName( "findProperties" );
> >      call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
> >      Vector params = new Vector();
> >      params.addElement( new Parameter( "sell", String.class, "Sell",
null
> )
> > );
> >      params.addElement( new Parameter( "propertyType", String.class,
> > "House", null ) );
> >      params.addElement( new Parameter( "city", String.class, "Union
City",
> > null ) );
> >      params.addElement( new Parameter( "lessPrice", String.class, "",
null
> )
> > );
> >      call.setParams( params );
> >
> >      try
> >        {
> >        System.out.println( "invoke service\n" + "  URL= " + url + "\n
URN
> > =" +
> >           urn );
> >        Response response = call.invoke( url, "urn:RealEstate" ); //
invoke
> > the service
> >
> > ...
>
> --
> Ian Snead
> Software Developer
> EzGov
> Work : 404 836 7957
>
> "Return a buffered reader to receive
>  back the response to whatever was sent to whatever."
>
>  - from the Apache SOAP documentation
>


Re: Exception? Root element of SOAP message must be:? Confused... Help!

Posted by Ian Snead <is...@ezgov.com>.
Scott Merritt wrote:
> 
> You don't by any chance know how to get Apache SOAP 2.2 to print the
> request?  I'm looking in the API docs now...

Interesting request; I had that thought myself, but
have not seen it done or seen an obvious method in
the API. Does Axis have this functionality?

Most folk seem to use a proxy to capture the contents
of a request / response.

Here are two that I have found useful :

http://www.pocketsoap.com/tcptrace/pt.asp
http://www.lanw.com/books/javasoap/default.htm

You will need the following code in your client to
direct an HTTP request to the proxy :

---
import org.apache.soap.transport.http.SOAPHTTPConnection;
    
SOAPHTTPConnection scxn = null; // transport object
          
if( debug )
{
     // proxy code
     scxn = new SOAPHTTPConnection();
     scxn.setProxyHost("localhost"); // proxy machine
     scxn.setProxyPort(proxyPort); // int
} // if

// Build the call.
Call call = new Call();
         
if( debug )
{
      call.setSOAPTransport(scxn); // HTTP
} // if
---

...sans the debug probably, and of course you 
still need the rest of what you are doing.

> 
> I do know that I'm doing a...
> 
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> 

That call, as is, seems to set the encodingStyle
element to "http://schemas.xmlsoap.org/soap/encoding/"

Run the request through a proxy and you will see what
I mean. :)

Hope this helps!

> And they're expecting...
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <ns1:findProperties xmlns:ns1="urn:RealEstate"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <sell xsi:type="xsd:string">Sell</sell> ...
> 
> -----Original Message-----
> From: Ian Snead [mailto:isnead@ezgov.com]
> Sent: Tuesday, November 06, 2001 11:09 AM
> To: soap-user@xml.apache.org
> Subject: Re: Exception? Root element of SOAP message must be:?
> Confused... Help!
> 
> Hello Scott,
> 
> Which SOAP implementations are you using
> on the client and the server sides? Could you
> post the full text of the request you sent?
> 
> I'm not sure how, but it looks as if you have
> the element 'Client' in the first node of your
> SOAP XML document. The exception is telling you
> that, as defined in the namespace
> 
> Scott Merritt wrote:
> >
> > What does this exception mean?  I've used web services before but this one
> > popped up and I'm not sure where I'm going wrong.
> >
> > SOAPException= SOAP-ENV:Client, Root element of a SOAP message must be:
> > 'http://schemas.xmlsoap.org/soap/envelope/:Envelope'.
> >
> > Code snippet...
> >
> >      URL url = new URL(
> > "http://tamino.demozone.softwareag.com/demozone/realEstate/findProperties"
> > );
> >      String urn = "urn:RealEstate";
> >
> >      Call call = new Call(); // prepare the service invocation
> >      call.setTargetObjectURI( urn );
> >      call.setMethodName( "findProperties" );
> >      call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
> >      Vector params = new Vector();
> >      params.addElement( new Parameter( "sell", String.class, "Sell", null
> )
> > );
> >      params.addElement( new Parameter( "propertyType", String.class,
> > "House", null ) );
> >      params.addElement( new Parameter( "city", String.class, "Union City",
> > null ) );
> >      params.addElement( new Parameter( "lessPrice", String.class, "", null
> )
> > );
> >      call.setParams( params );
> >
> >      try
> >        {
> >        System.out.println( "invoke service\n" + "  URL= " + url + "\n  URN
> > =" +
> >           urn );
> >        Response response = call.invoke( url, "urn:RealEstate" ); // invoke
> > the service
> >
> > ...
> 
> --
> Ian Snead
> Software Developer
> EzGov
> Work : 404 836 7957
> 
> "Return a buffered reader to receive
>  back the response to whatever was sent to whatever."
> 
>  - from the Apache SOAP documentation

--
Ian Snead
Software Developer
EzGov
Work : 404 836 7957

"Return a buffered reader to receive 
 back the response to whatever was sent to whatever."
 
 - from the Apache SOAP documentation