SOAP Message Handler - weblogic.developer.interest.webservices.general(Archived)

I have a stand-alone java client which invokes a WSE enabled .NET web service. A custom policy file (no encryption or certificate. Just username token) is associated with the java client. I also include a SOAP handler to display the SOAP request. When I ran the client,
the display of the SOAP request message was quite different between the console and the .NET server trace file. The statement "messageContext.getMessage().toString());" just display "weblogic.xml.saaj.SOAPMessageImpl#502e15"
Could some one please tell me why the SOAP handler did not display the rest of the SOAP message like the .NET server trace file (shown below)?
Here is a snippet of my SOAP Handler handleRequest implementation:
public boolean handleRequest(MessageContext context) {
System.out.println("handle request...");
SOAPMessageContext messageContext = (SOAPMessageContext) context;
System.out.println("** Request: " + messageContext.getMessage().toString());
SOAPHeader sh = null;
try {
sh = messageContext.getMessage().getSOAPHeader();
} catch (SOAPException se) {
}
Iterator it = sh.examineAllHeaderElements();
while (it.hasNext()) {
System.out.println("*** There are SOAP Headers.....");
SOAPHeaderElement elem = (SOAPHeaderElement)it.next();
System.out.println("header ==> " + elem.getElementName().getQualifiedName());
}
return true;
------------------------------------------------------------------
Here is the display on the console:
run:
[java] in class digimarc.foto.webservice.clientstub.ClientHandler init()
[java] in class digimarc.foto.webservice.clientstub.ClientHandler init()
[java] in class digimarc.foto.webservice.clientstub.ClientHandler init()
[java] handle request...
[java] ** Request: weblogic.xml.saaj.SOAPMessageImpl#502e15
[java] *** There are SOAP Headers.....
[java] header ==> wsse:Security
[java] <11-Apr-2008 2:14:04 o'clock PM ADT> <Info> <WebService-LogHandler> <BEA-000000> <weblogic.xml.saaj.SOAPMessageImpl#502e15>
[java] ** Fault: weblogic.xml.saaj.SOAPMessageImpl#57b10b
[java] <11-Apr-2008 2:14:06 o'clock PM ADT> <Info> <WebService-LogHandler> <BEA-000000> <weblogic.xml.saaj.SOAPMessageImpl#57b10b>
[java] fetchMostRecent() Failed...
--------------------------------------------------------------
.NET web server trace:
<inputMessage utc="3/28/2008 3:05:43 PM" messageId="urn:uuid:23052686-df58-4144-9ec9-52617e5b5cd6">
<processingStep description="Unprocessed message">
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" env:mustUnderstand="1">
<wsse:UsernameToken wsu:Id="unt_R4qflJg2MR0no0AY" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>nbddls\john</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">G0ggin!</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</env:Header>
<env:Body>
<m:ImagingFolioFetchMostRecent xmlns:m="urn:digimarc.com:ImageServer:WebServices">
<m:personID>1001917</m:personID>
</m:ImagingFolioFetchMostRecent>
</env:Body>
</env:Envelope>
</processingStep>
......
......
</inputMessage>

Related

Help! SOAP XML response contains "<" instead of '<'

Running on WL 6.1. I've created a stateless session EJB. I've already created
the EAR file and deployed it in the console. I can view the WSDL, etc, etc. Everything
looks okay on the server.
We have a C client that will be opening a socket to post an HTTP request to our
SOAP server. I've simulated this by using a Java client to open a socket and send
the following the HTTP request:
-------------------------
POST /vru/wsvru HTTP/1.0
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: 474
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getOrders xmlns:ns1="urn:vru" SOAP-ENV:encodingStyle="http://schemas.xmlsoa
p.org/soap/encoding/">
<ssn xsi:type="xsd:string">111-22-3333</ssn>
<zip xsi:type="xsd:string">22222</zip>
</ns1:getOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------
The server gets the request and returns a String. The return type for the EJB
method is "String". Specifically, we're trying to return an XML String. I get
back the following (forgive the text wrapping):
---------------------
HTTP/1.0 200 OKDate: Mon, 18 Feb 2002 23:22:23 GMTServer: WebLogic Web
Logic Server 6.1 SP2 12/18/2001 11:13:46 #154529 Content-Type: text/xml; charset=UTF-8Connection:
Close<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getOrdersResponse
xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='xsd:string'><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE VruInterface
SYSTEM "VruInterface.dtd"><VruInter
face> <Error> <errorNumber>1</errorNumber> <er
rorText>Could not find consumer</errorText> </Error></VruInter
face></return></ns0:getOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
------------------------------
The pertinent part is really the returned String:
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText> </Error>
</VruInterface>
The problem is that the XML '<' characters are being converted into "<".
With Apache SOAP, I was able to specify a custom serializer to keep it from doing
this.
I don't see a way to do this with WebLogic 6.1 SOAP.
How can I keep this from happening????
Thanks in advance.
Hi Chris,
SOAP encoding (the one you are using) does not allow XML to be embedded in a request
or response. You will need to use literal XML encoding to do what you want to
do. The namespace URL for this is encoding style is http://xml.apache.org/xml-soap/literalxml,
which you set using the setEncodingStyle() method on the SoapMethod object in
you Java client. Like this:
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml http://schemas.xmlsoap.org/soap/encoding/");
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
>
>
Running on WL 6.1. I've created a stateless session EJB. I've already
created
the EAR file and deployed it in the console. I can view the WSDL, etc,
etc. Everything
looks okay on the server.
We have a C client that will be opening a socket to post an HTTP request
to our
SOAP server. I've simulated this by using a Java client to open a socket
and send
the following the HTTP request:
-------------------------
POST /vru/wsvru HTTP/1.0
Host: localhost
Content-Length: 474
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getOrders xmlns:ns1="urn:vru" SOAP-ENV:encodingStyle="http://schemas.xmlsoa
p.org/soap/encoding/">
<ssn xsi:type="xsd:string">111-22-3333</ssn>
<zip xsi:type="xsd:string">22222</zip>
</ns1:getOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------
The server gets the request and returns a String. The return type for
the EJB
method is "String". Specifically, we're trying to return an XML String.
I get
back the following (forgive the text wrapping):
---------------------
HTTP/1.0 200 OKDate: Mon, 18 Feb 2002 23:22:23 GMTServer: WebLogic Web
Logic Server 6.1 SP2 12/18/2001 11:13:46 #154529 Content-Type: text/xml;
charset=UTF-8Connection:
Close<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getOrdersResponse
xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='xsd:string'><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE
VruInterface
SYSTEM "VruInterface.dtd"><VruInter
face> <Error> <errorNumber>1</errorNumber>
<er
rorText>Could not find consumer</errorText> </Error></VruInter
face></return></ns0:getOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
------------------------------
The pertinent part is really the returned String:
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText> </Error>
</VruInterface>
The problem is that the XML '<' characters are being converted into "<".
With Apache SOAP, I was able to specify a custom serializer to keep it
from doing
this.
I don't see a way to do this with WebLogic 6.1 SOAP.
How can I keep this from happening????
Thanks in advance.
Thanks for the response. However, there's still a problem.
Like I said, we'll be using a socket(from a C program) to pass a SOAP request
to the server. We won't be using the API mentioned in the Weblogic documentation.
FYI...I've written a client application using the Java API just for testing purposes
and the results come back fine, even though the response String is XML. Here's
the sample program that I used:
-------------------------
public class WSClient{
public static void main( String[] arg ) throws Exception
{
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.soap.http.SoapInitialContextFactory");
h.put("weblogic.soap.wsdl.interface",
WebServices.class.getName() );
Context context = new InitialContext(h);
WebServices service = (WebServices)context.lookup(
"http://localhost:7001/vru/WebServicesHome/WebServicesHome.wsdl"
);
String result = (String)service.getOrders("111-22-3333","22222");
System.out.print("result = " + result );
}
}
-------------------------
And the results are:
result = <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText>
</Error>
</VruInterface>
It looks like in this case that the String gets deserialized back on the client?
Also, it looks like the client first gets a handle to the bean, then calls a method
on it. Obviously, a C program will not be able to do this.
I had this same problem when I tried this with Apache...however, I could specify
a custom serializer that would not encode the string, and it worked fine.
As stated before, our client will be a C program. So I need a way to keep the
String from getting encoded. Is there a way to do this in WL 6.1 SOAP?
Thanks.
"Michael Wooten" <wooten_michael#hotmail.com> wrote:
>
Hi Chris,
SOAP encoding (the one you are using) does not allow XML to be embedded
in a request
or response. You will need to use literal XML encoding to do what you
want to
do. The namespace URL for this is encoding style is http://xml.apache.org/xml-soap/literalxml,
which you set using the setEncodingStyle() method on the SoapMethod object
in
you Java client. Like this:
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml http://schemas.xmlsoap.org/soap/encoding/");
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
Running on WL 6.1. I've created a stateless session EJB. I've already
created
the EAR file and deployed it in the console. I can view the WSDL, etc,
etc. Everything
looks okay on the server.
We have a C client that will be opening a socket to post an HTTP request
to our
SOAP server. I've simulated this by using a Java client to open a socket
and send
the following the HTTP request:
-------------------------
POST /vru/wsvru HTTP/1.0
Host: localhost
Content-Length: 474
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getOrders xmlns:ns1="urn:vru" SOAP-ENV:encodingStyle="http://schemas.xmlsoa
p.org/soap/encoding/">
<ssn xsi:type="xsd:string">111-22-3333</ssn>
<zip xsi:type="xsd:string">22222</zip>
</ns1:getOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------
The server gets the request and returns a String. The return type for
the EJB
method is "String". Specifically, we're trying to return an XML String.
I get
back the following (forgive the text wrapping):
---------------------
HTTP/1.0 200 OKDate: Mon, 18 Feb 2002 23:22:23 GMTServer: WebLogic Web
Logic Server 6.1 SP2 12/18/2001 11:13:46 #154529 Content-Type: text/xml;
charset=UTF-8Connection:
Close<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getOrdersResponse
xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='xsd:string'><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE
VruInterface
SYSTEM "VruInterface.dtd"><VruInter
face> <Error> <errorNumber>1</errorNumber>
<er
rorText>Could not find consumer</errorText> </Error></VruInter
face></return></ns0:getOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
------------------------------
The pertinent part is really the returned String:
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText> </Error>
</VruInterface>
The problem is that the XML '<' characters are being converted into"<".
With Apache SOAP, I was able to specify a custom serializer to keepit
from doing
this.
I don't see a way to do this with WebLogic 6.1 SOAP.
How can I keep this from happening????
Thanks in advance.
I've also tried running the "dynamic java client" example in the WebLogic documentation.
I set verbose mode to on, so that I can see what's getting sent/received...and
I tried adding the line that was suggested...(method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");)
My sample program is as follows:
public class DynWSClient
{
public static void main( String[] arg ) throws Exception{
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.soap.http.SoapInitialContextFactory");
h.put("weblogic.soap.verbose", "true" );
Context context = new InitialContext(h);
WebServiceProxy proxy = (WebServiceProxy)context.lookup(
"http://localhost:7001/vru/WebServicesHome/WebServicesHome.wsdl" );
SoapMethod method = proxy.getMethod( "getOrders" );
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml http://schemas.xmlsoap.org/soap/encoding/");
String result = (String)method.invoke(
new Object[]{ "111-22-3333",  "22222"  } );
System.out.print( "result = " + result );
}
}
If I take out the setEncodingType() line, it works fine, but I'm still seeing
"<" instead of '<'.
If I leave in the setEncodingType() line, I get:
-------------- SENDING XML --------------
Exception in thread "main" org.xml.sax.SAXException: No codec for decoding http:
//xml.apache.org/xml-soap/literalxml: [ CodecFactory: http://schemas.xmlsoap.org
/soap/encoding/=null, =null]
at weblogic.soap.codec.CodecFactory.encode(CodecFactory.java:121)
at weblogic.soap.codec.Operation.write(Operation.java:137)
at weblogic.soap.codec.SoapMessage.writeOperation(SoapMessage.java:207)
at weblogic.soap.codec.SoapMessage.write(SoapMessage.java:156)
at weblogic.soap.WebServiceProxy.send(WebServiceProxy.java:450)
at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:428)
at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
at DynWSClient.main(DynWSClient.java:33)
Any ideas? Thanks.
"Michael Wooten" <wooten_michael#hotmail.com> wrote:
>
Hi Chris,
SOAP encoding (the one you are using) does not allow XML to be embedded
in a request
or response. You will need to use literal XML encoding to do what you
want to
do. The namespace URL for this is encoding style is http://xml.apache.org/xml-soap/literalxml,
which you set using the setEncodingStyle() method on the SoapMethod object
in
you Java client. Like this:
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml http://schemas.xmlsoap.org/soap/encoding/");
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
Running on WL 6.1. I've created a stateless session EJB. I've already
created
the EAR file and deployed it in the console. I can view the WSDL, etc,
etc. Everything
looks okay on the server.
We have a C client that will be opening a socket to post an HTTP request
to our
SOAP server. I've simulated this by using a Java client to open a socket
and send
the following the HTTP request:
-------------------------
POST /vru/wsvru HTTP/1.0
Host: localhost
Content-Length: 474
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getOrders xmlns:ns1="urn:vru" SOAP-ENV:encodingStyle="http://schemas.xmlsoa
p.org/soap/encoding/">
<ssn xsi:type="xsd:string">111-22-3333</ssn>
<zip xsi:type="xsd:string">22222</zip>
</ns1:getOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------
The server gets the request and returns a String. The return type for
the EJB
method is "String". Specifically, we're trying to return an XML String.
I get
back the following (forgive the text wrapping):
---------------------
HTTP/1.0 200 OKDate: Mon, 18 Feb 2002 23:22:23 GMTServer: WebLogic Web
Logic Server 6.1 SP2 12/18/2001 11:13:46 #154529 Content-Type: text/xml;
charset=UTF-8Connection:
Close<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getOrdersResponse
xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='xsd:string'><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE
VruInterface
SYSTEM "VruInterface.dtd"><VruInter
face> <Error> <errorNumber>1</errorNumber>
<er
rorText>Could not find consumer</errorText> </Error></VruInter
face></return></ns0:getOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
------------------------------
The pertinent part is really the returned String:
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText> </Error>
</VruInterface>
The problem is that the XML '<' characters are being converted into"<".
With Apache SOAP, I was able to specify a custom serializer to keepit
from doing
this.
I don't see a way to do this with WebLogic 6.1 SOAP.
How can I keep this from happening????
Thanks in advance.
Hi Chris,
Man, this thing is starting to sprouting heads :-)
To get rid of the exception, you'll need to do the following in the Java client
code:
1. get a CodecFactory.
2. add a SoapEncodingCodec instance to it (the CodecFactory).
3. add a LiteralCodec instance to it (the CodecFactory).
4. set the proxy's codec factory to the one from step 1.
Like so:
### START CLIENT CODE FRAGMENT ###
import weblogic.soap.codec.CodecFactory;
import weblogic.soap.codec.SoapEncodingCodec;
import weblogic.soap.codec.LiteralCodec;
public class DynWSClient
{
public static void main( String[] arg ) throws Exception
{
CodecFactory factory = CodecFactory.newInstance();
factory.register( new SoapEncodingCodec() );
factory.register( new LiteralCodec() );
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.soap.http.SoapInitialContextFactory");
h.put("weblogic.soap.encoding.factory", factory );
h.put("weblogic.soap.verbose", "true" );
Context context = new InitialContext(h);
WebServiceProxy proxy = (WebServiceProxy)context.lookup(
"http://localhost:7001/vru/WebServicesHome/WebServicesHome.wsdl" );
SoapMethod method = proxy.getMethod( "getOrders" );
// Make sure you have a space (ASCII 32) between
// the two encoding styles !!
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");
String result = (String)method.invoke(
new Object[]{ "111-22-3333",  "22222"  } );
System.out.print( "result = " + result );
}
}
If this C++ client you were speaking of is going to be using a C++ based SOAP
toolkit (e.g. Systinet WASP Lite for C++, etc.), why don't you use that instead
of Java? It not (meaning the C++ client is not going to use a SOAP toolkit), I
recommend switching to whatever method will be used ;-) If the above code works,
you will be specifying the encodingStyle="http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/" attribute in the <SOAP-ENC:Body> element
of your request.
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
>
I've also tried running the "dynamic java client" example in the WebLogic
documentation.
I set verbose mode to on, so that I can see what's getting sent/received...and
I tried adding the line that was suggested...(method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");)
My sample program is as follows:
public class DynWSClient
{
public static void main( String[] arg ) throws Exception{
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.soap.http.SoapInitialContextFactory");
h.put("weblogic.soap.verbose", "true" );
Context context = new InitialContext(h);
WebServiceProxy proxy = (WebServiceProxy)context.lookup(
"http://localhost:7001/vru/WebServicesHome/WebServicesHome.wsdl" );
SoapMethod method = proxy.getMethod( "getOrders" );
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");
String result = (String)method.invoke(
new Object[]{ "111-22-3333",  "22222"  } );
System.out.print( "result = " + result );
}
}
If I take out the setEncodingType() line, it works fine, but I'm still
seeing
"<" instead of '<'.
If I leave in the setEncodingType() line, I get:
-------------- SENDING XML --------------
Exception in thread "main" org.xml.sax.SAXException: No codec for decoding
http:
//xml.apache.org/xml-soap/literalxml: [ CodecFactory: http://schemas.xmlsoap.org
/soap/encoding/=null, =null]
at weblogic.soap.codec.CodecFactory.encode(CodecFactory.java:121)
at weblogic.soap.codec.Operation.write(Operation.java:137)
at weblogic.soap.codec.SoapMessage.writeOperation(SoapMessage.java:207)
at weblogic.soap.codec.SoapMessage.write(SoapMessage.java:156)
at weblogic.soap.WebServiceProxy.send(WebServiceProxy.java:450)
at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:428)
at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
at DynWSClient.main(DynWSClient.java:33)
Any ideas? Thanks.
"Michael Wooten" <wooten_michael#hotmail.com> wrote:
Hi Chris,
SOAP encoding (the one you are using) does not allow XML to be embedded
in a request
or response. You will need to use literal XML encoding to do what you
want to
do. The namespace URL for this is encoding style is http://xml.apache.org/xml-soap/literalxml,
which you set using the setEncodingStyle() method on the SoapMethodobject
in
you Java client. Like this:
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml http://schemas.xmlsoap.org/soap/encoding/");
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
Running on WL 6.1. I've created a stateless session EJB. I've already
created
the EAR file and deployed it in the console. I can view the WSDL, etc,
etc. Everything
looks okay on the server.
We have a C client that will be opening a socket to post an HTTP request
to our
SOAP server. I've simulated this by using a Java client to open a socket
and send
the following the HTTP request:
-------------------------
POST /vru/wsvru HTTP/1.0
Host: localhost
Content-Length: 474
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getOrders xmlns:ns1="urn:vru" SOAP-ENV:encodingStyle="http://schemas.xmlsoa
p.org/soap/encoding/">
<ssn xsi:type="xsd:string">111-22-3333</ssn>
<zip xsi:type="xsd:string">22222</zip>
</ns1:getOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------
The server gets the request and returns a String. The return type for
the EJB
method is "String". Specifically, we're trying to return an XML String.
I get
back the following (forgive the text wrapping):
---------------------
HTTP/1.0 200 OKDate: Mon, 18 Feb 2002 23:22:23 GMTServer: WebLogicWeb
Logic Server 6.1 SP2 12/18/2001 11:13:46 #154529 Content-Type: text/xml;
charset=UTF-8Connection:
Close<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getOrdersResponse
xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='xsd:string'><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE
VruInterface
SYSTEM "VruInterface.dtd"><VruInter
face> <Error> <errorNumber>1</errorNumber>
<er
rorText>Could not find consumer</errorText> </Error></VruInter
face></return></ns0:getOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
------------------------------
The pertinent part is really the returned String:
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText> </Error>
</VruInterface>
The problem is that the XML '<' characters are being converted into"<".
With Apache SOAP, I was able to specify a custom serializer to keepit
from doing
this.
I don't see a way to do this with WebLogic 6.1 SOAP.
How can I keep this from happening????
Thanks in advance.
Thanks for the help. I tried the last example. However, it still doesn't work.
I no longer get the exception, but the data still comes back with "<" in it.
Is the encoding type in the request tied to the encoding type in the response?
I.e. is this past attempt really supposed to affect the encoding of the response?
They're going to be using C with a socket. I don't believe any SOAP toolkit is
being used. And from what I'm told they would "manually" parse the XML data. This
probably isn't the typical SOAP scenario.
We'll possibly just go to a servlet to do this.
I'll try any other suggestions though.
Thanks.
"Michael Wooten" <wooten_michael#hotmail.com> wrote:
>
Hi Chris,
Man, this thing is starting to sprouting heads :-)
To get rid of the exception, you'll need to do the following in the Java
client
code:
1. get a CodecFactory.
2. add a SoapEncodingCodec instance to it (the CodecFactory).
3. add a LiteralCodec instance to it (the CodecFactory).
4. set the proxy's codec factory to the one from step 1.
Like so:
### START CLIENT CODE FRAGMENT ###
import weblogic.soap.codec.CodecFactory;
import weblogic.soap.codec.SoapEncodingCodec;
import weblogic.soap.codec.LiteralCodec;
public class DynWSClient
{
public static void main( String[] arg ) throws Exception
{
CodecFactory factory = CodecFactory.newInstance();
factory.register( new SoapEncodingCodec() );
factory.register( new LiteralCodec() );
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.soap.http.SoapInitialContextFactory");
h.put("weblogic.soap.encoding.factory", factory );
h.put("weblogic.soap.verbose", "true" );
Context context = new InitialContext(h);
WebServiceProxy proxy = (WebServiceProxy)context.lookup(
"http://localhost:7001/vru/WebServicesHome/WebServicesHome.wsdl" );
SoapMethod method = proxy.getMethod( "getOrders" );
// Make sure you have a space (ASCII 32) between
// the two encoding styles !!
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");
String result = (String)method.invoke(
new Object[]{ "111-22-3333",  "22222"  } );
System.out.print( "result = " + result );
}
}
If this C++ client you were speaking of is going to be using a C++ based
SOAP
toolkit (e.g. Systinet WASP Lite for C++, etc.), why don't you use that
instead
of Java? It not (meaning the C++ client is not going to use a SOAP toolkit),
I
recommend switching to whatever method will be used ;-) If the above
code works,
you will be specifying the encodingStyle="http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/" attribute in the <SOAP-ENC:Body>
element
of your request.
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
I've also tried running the "dynamic java client" example in the WebLogic
documentation.
I set verbose mode to on, so that I can see what's getting sent/received...and
I tried adding the line that was suggested...(method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");)
My sample program is as follows:
public class DynWSClient
{
public static void main( String[] arg ) throws Exception{
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.soap.http.SoapInitialContextFactory");
h.put("weblogic.soap.verbose", "true" );
Context context = new InitialContext(h);
WebServiceProxy proxy = (WebServiceProxy)context.lookup(
"http://localhost:7001/vru/WebServicesHome/WebServicesHome.wsdl" );
SoapMethod method = proxy.getMethod( "getOrders" );
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxml
http://schemas.xmlsoap.org/soap/encoding/");
String result = (String)method.invoke(
new Object[]{ "111-22-3333",  "22222"  } );
System.out.print( "result = " + result );
}
}
If I take out the setEncodingType() line, it works fine, but I'm still
seeing
"<" instead of '<'.
If I leave in the setEncodingType() line, I get:
-------------- SENDING XML --------------
Exception in thread "main" org.xml.sax.SAXException: No codec for decoding
http:
//xml.apache.org/xml-soap/literalxml: [ CodecFactory: http://schemas.xmlsoap.org
/soap/encoding/=null, =null]
at weblogic.soap.codec.CodecFactory.encode(CodecFactory.java:121)
at weblogic.soap.codec.Operation.write(Operation.java:137)
at weblogic.soap.codec.SoapMessage.writeOperation(SoapMessage.java:207)
at weblogic.soap.codec.SoapMessage.write(SoapMessage.java:156)
at weblogic.soap.WebServiceProxy.send(WebServiceProxy.java:450)
at weblogic.soap.WebServiceProxy.invoke(WebServiceProxy.java:428)
at weblogic.soap.SoapMethod.invoke(SoapMethod.java:186)
at DynWSClient.main(DynWSClient.java:33)
Any ideas? Thanks.
"Michael Wooten" <wooten_michael#hotmail.com> wrote:
Hi Chris,
SOAP encoding (the one you are using) does not allow XML to be embedded
in a request
or response. You will need to use literal XML encoding to do what you
want to
do. The namespace URL for this is encoding style is http://xml.apache.org/xml-soap/literalxml,
which you set using the setEncodingStyle() method on the SoapMethodobject
in
you Java client. Like this:
method.setEncodingStyle("http://xml.apache.org/xml-soap/literalxmlhttp://schemas.xmlsoap.org/soap/encoding/");
Regards,
Mike Wooten
"Chris Bridges" <chris#allconnect.com> wrote:
Running on WL 6.1. I've created a stateless session EJB. I've already
created
the EAR file and deployed it in the console. I can view the WSDL,etc,
etc. Everything
looks okay on the server.
We have a C client that will be opening a socket to post an HTTP request
to our
SOAP server. I've simulated this by using a Java client to open asocket
and send
the following the HTTP request:
-------------------------
POST /vru/wsvru HTTP/1.0
Host: localhost
Content-Length: 474
SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getOrders xmlns:ns1="urn:vru" SOAP-ENV:encodingStyle="http://schemas.xmlsoa
p.org/soap/encoding/">
<ssn xsi:type="xsd:string">111-22-3333</ssn>
<zip xsi:type="xsd:string">22222</zip>
</ns1:getOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-------------------------
The server gets the request and returns a String. The return typefor
the EJB
method is "String". Specifically, we're trying to return an XML String.
I get
back the following (forgive the text wrapping):
---------------------
HTTP/1.0 200 OKDate: Mon, 18 Feb 2002 23:22:23 GMTServer: WebLogicWeb
Logic Server 6.1 SP2 12/18/2001 11:13:46 #154529 Content-Type: text/xml;
charset=UTF-8Connection:
Close<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'><SOAP-ENV:Body><ns0:getOrdersResponse
xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='xsd:string'><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE
VruInterface
SYSTEM "VruInterface.dtd"><VruInter
face> <Error> <errorNumber>1</errorNumber>
<er
rorText>Could not find consumer</errorText> </Error></VruInter
face></return></ns0:getOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
------------------------------
The pertinent part is really the returned String:
<!DOCTYPE VruInterface SYSTEM "VruInterface.dtd">
<VruInterface>
<Error>
<errorNumber>1</errorNumber>
<errorText>Could not find consumer</errorText> </Error>
</VruInterface>
The problem is that the XML '<' characters are being converted into"<".
With Apache SOAP, I was able to specify a custom serializer to keepit
from doing
this.
I don't see a way to do this with WebLogic 6.1 SOAP.
How can I keep this from happening????
Thanks in advance.
Hi Chris,
The fact is, you aren't going to be able to get rid of the < entities in the
response, with a return type of string ;-) The value returned from the method
will not have them in it, but the SOAP response will.
The reason is because they are being placed there by the WebLogic "pull" parser.
The only way I can think of to not have them in there, is to change the return
type to org.w3c.dom.Element. If the C++ client is not using a SOAP toolkit, it
should be able to deal with the SOAP response as a string.
You've been through hell with this, so here's the console output which at least
proves that the what I just said will get rid of the < entities ;-)
-------------- SENDING XML --------------
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://
schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/

Pass an object in fault

I have my proxy service calling a business service built over an EJB. In the exception thrown by the Business Service I am passing an object.
The exception caught by the business Service is interpreted by the OSB as this
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>customer already exists</faultstring>
<detail>
<java:SomeException xmlns:java="java:xyz.bus.customer.custinfo.vo.Exception">
<java:Code>ERRXYZ_0159</java:Code>
<java:ErrorMessage>customer already exists</java:ErrorMessage>
*<java:Details>*
*[Lxyz.bus.customer.custinfo.vo.customer.CustomerSummaryVO;#6339e16d*
*</java:Details>*
</java:SomeException>
</detail>
</env:Fault>
</env:Body>
The constructor of the Exception is like this
public SomeException (String code, String errorMessage, CustomerSummary summary)
I want that the details of the object should come in the <java:details></java:details> tag
Is t here a solution other that constructing a string from the object details?

mapping lookup up failure with input JavaBean with an array of strings

To receive input data our Web service defines a JavaBean one element of which is
an array of strings. When a test Java client calls the service method the call
is completed successfully. When a Perl client calls the service method an exception
is returned. If I understand BEA's Web service documentation, it isn't necessary
to do development for the service specifically to enable correct processing of
an array of strings.
In our environment we are running WL 8.1 SP 1.
Please review the problem documentation and explain to me the cause of the exception
and what I must do to prevent it.
Thank you.
___________________________________________________________________
The exception:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Exception
during processing: weblogic.xml.schema.binding.DeserializationException: mapping
lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema context=TypedSchemaContext{javaType=java.lang.String}
(see Fault Detail for stacktrace)</faultstring><detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"/>weblogic.xml.schema.binding.DeserializationException:
mapping lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema
context=TypedSchemaContext{javaType=java.lang.String}
     at weblogic.xml.schema.binding.RuntimeUtils.lookup_deserializer(RuntimeUtils.java:461)
     at weblogic.xml.schema.binding.SoapArrayCodecBase.getComponentDeserializer(SoapArrayCodecBase.java:574)
     at weblogic.xml.schema.binding.SoapArrayCodecBase.deserialize(SoapArrayCodecBase.java:285)
     at weblogic.xml.schema.binding.BeanCodecBase.processElement(BeanCodecBase.java:183)
     at weblogic.xml.schema.binding.BeanCodecBase.processAllElements(BeanCodecBase.java:165)
     at weblogic.xml.schema.binding.BeanCodecBase.processElements(BeanCodecBase.java:145)
     at weblogic.xml.schema.binding.BeanCodecBase.deserialize(BeanCodecBase.java:108)
     at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:428)
     at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:328)
     at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:384)
     at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:458)
     at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
     at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
     at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)
     [more]
The XML generated for the Perl client:
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getWorkOrdersByFilters
xmlns:namesp1="ncr.com"><gIMServiceRequest xsi:type="ns:GIMServiceRequest" xmlns:ns="java:com.ncr.gim.bean.service"><applicationID
xsi:type="xsd:string">REVLOG</applicationID><nodeId xsi:type="xsd:string">00XH</nodeId><stopCodes
xsi:type="namesp2:array" SOAP-ENC:arrayType="xsd:string[2]"><xsd:string xsi:type="xsd:string">06</xsd:string><xsd:string
xsi:type="xsd:string">16</xsd:string></stopCodes></gIMServiceRequest></namesp1:getWorkOrdersByFilters></SOAP-ENV:Body></SOAP-ENV:Envelope>
The XML generated for a test Java client:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getWorkOrdersByFilters
xmlns:m="ncr.com"><gIMServiceRequest xmlns:n1="java:com.ncr.gim.bean.service"
xsi:type="n1:GIMServiceRequest"><CSRCode xsi:type="xsd:string">987x00</CSRCode><applicationID
xsi:type="xsd:string">GIM</applicationID><incidentNbr xsi:nil="true"/><nodeId
xsi:type="xsd:string">00T5</nodeId><stopCodes soapenc:arrayType="xsd:string[3]"><xsd:string
xsi:type="xsd:string">00</xsd:string><xsd:string xsi:type="xsd:string">01</xsd:string><xsd:string
xsi:type="xsd:string">02</xsd:string></stopCodes></gIMServiceRequest></m:getWorkOrdersByFilters></env:Body></env:Envelope>
The JavaBean:
public class GIMServiceRequest implements Serializable {
     private String applicationID = GIMConstants.UNKNOWN_APPLICATION_ID;
     private String nodeId = null;
     private String incidentNbr = null;
     private String CSRCode = null;
     private String[] stopCodes = null;
     public void setStopCodes(String[] aStopCodes) {
          stopCodes = aStopCodes;
     }
     public String[] getStopCodes() {
          return stopCodes;
     }
     [more]
}
The service build.xml file:
<project name="GIMService" default="all" basedir=".">
     <target name="all" depends="ear"/>
<target name="ear">
<servicegen
destEar="GIMService.ear"
contextURI="GIMContext" >
<service
     ejbJar="GIMServiceEJB.jar"
     targetNamespace="ncr.com"
                    serviceName="GIMService"
                    serviceURI="/GIM_URI"
                    generateTypes="True"
                    expandMethods="True"
                    style="rpc"
                    protocol="http" >
          <client
               clientJarName="GIMService_client.jar"
               packageName="com.ncr.gim.gimservice.client" >
          </client>
</service>
</servicegen>
</target>
</project>
Hi Jeff,
Looks like the Perl client is using an older (deprecated) schema
namespace "http://www.w3.org/1999/XMLSchema" that is causing this
failure.
Hope this helps,
Bruce
Jeff Carey wrote:
>
To receive input data our Web service defines a JavaBean one element of which is
an array of strings. When a test Java client calls the service method the call
is completed successfully. When a Perl client calls the service method an exception
is returned. If I understand BEA's Web service documentation, it isn't necessary
to do development for the service specifically to enable correct processing of
an array of strings.
In our environment we are running WL 8.1 SP 1.
Please review the problem documentation and explain to me the cause of the exception
and what I must do to prevent it.
Thank you.
___________________________________________________________________
The exception:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body><env:Fault><faultcode>env:Server</faultcode><faultstring>Exception
during processing: weblogic.xml.schema.binding.DeserializationException: mapping
lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema context=TypedSchemaContext{javaType=java.lang.String}
(see Fault Detail for stacktrace)</faultstring><detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0"/>weblogic.xml.schema.binding.DeserializationException:
mapping lookup failure. type=['http://www.w3.org/1999/XMLSchema']:xsd:string schema
context=TypedSchemaContext{javaType=java.lang.String}
at weblogic.xml.schema.binding.RuntimeUtils.lookup_deserializer(RuntimeUtils.java:461)
at weblogic.xml.schema.binding.SoapArrayCodecBase.getComponentDeserializer(SoapArrayCodecBase.java:574)
at weblogic.xml.schema.binding.SoapArrayCodecBase.deserialize(SoapArrayCodecBase.java:285)
at weblogic.xml.schema.binding.BeanCodecBase.processElement(BeanCodecBase.java:183)
at weblogic.xml.schema.binding.BeanCodecBase.processAllElements(BeanCodecBase.java:165)
at weblogic.xml.schema.binding.BeanCodecBase.processElements(BeanCodecBase.java:145)
at weblogic.xml.schema.binding.BeanCodecBase.deserialize(BeanCodecBase.java:108)
at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:428)
at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:328)
at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:384)
at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:458)
at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:78)
at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)
at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)
[more]
The XML generated for the Perl client:
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:namesp2="http://namespaces.soaplite.com/perl"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:getWorkOrdersByFilters
xmlns:namesp1="ncr.com"><gIMServiceRequest xsi:type="ns:GIMServiceRequest" xmlns:ns="java:com.ncr.gim.bean.service"><applicationID
xsi:type="xsd:string">REVLOG</applicationID><nodeId xsi:type="xsd:string">00XH</nodeId><stopCodes
xsi:type="namesp2:array" SOAP-ENC:arrayType="xsd:string[2]"><xsd:string xsi:type="xsd:string">06</xsd:string><xsd:string
xsi:type="xsd:string">16</xsd:string></stopCodes></gIMServiceRequest></namesp1:getWorkOrdersByFilters></SOAP-ENV:Body></SOAP-ENV:Envelope>
The XML generated for a test Java client:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Header/><env:Body
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getWorkOrdersByFilters
xmlns:m="ncr.com"><gIMServiceRequest xmlns:n1="java:com.ncr.gim.bean.service"
xsi:type="n1:GIMServiceRequest"><CSRCode xsi:type="xsd:string">987x00</CSRCode><applicationID
xsi:type="xsd:string">GIM</applicationID><incidentNbr xsi:nil="true"/><nodeId
xsi:type="xsd:string">00T5</nodeId><stopCodes soapenc:arrayType="xsd:string[3]"><xsd:string
xsi:type="xsd:string">00</xsd:string><xsd:string xsi:type="xsd:string">01</xsd:string><xsd:string
xsi:type="xsd:string">02</xsd:string></stopCodes></gIMServiceRequest></m:getWorkOrdersByFilters></env:Body></env:Envelope>
The JavaBean:
public class GIMServiceRequest implements Serializable {
private String applicationID = GIMConstants.UNKNOWN_APPLICATION_ID;
private String nodeId = null;
private String incidentNbr = null;
private String CSRCode = null;
private String[] stopCodes = null;
public void setStopCodes(String[] aStopCodes) {
stopCodes = aStopCodes;
}
public String[] getStopCodes() {
return stopCodes;
}
[more]
}
The service build.xml file:
<project name="GIMService" default="all" basedir=".">
<target name="all" depends="ear"/>
<target name="ear">
<servicegen
destEar="GIMService.ear"
contextURI="GIMContext" >
<service
ejbJar="GIMServiceEJB.jar"
targetNamespace="ncr.com"
serviceName="GIMService"
serviceURI="/GIM_URI"
generateTypes="True"
expandMethods="True"
style="rpc"
protocol="http" >
<client
clientJarName="GIMService_client.jar"
packageName="com.ncr.gim.gimservice.client" >
</client>
</service>
</servicegen>
</target>
</project>

SOAP envelope namespace URI missing

Hi. If I use SAAJ 1.1.1 from JWSDP1.1 to create a SOAP envelope like this:
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPElement bodyElement = body.addChildElement(envelope.createName("doGoogleSearch",
"ns1", "urn:GoogleSearch"));
bodyElement.addChildElement("q").addTextNode("shrdlu winograd maclisp teletype");
message.saveChanges();
I get a SOAP envelope that looks like this:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header></soap-env:Header>
<soap-env:Body>
<ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch">
<q>shrdlu winograd maclisp teletype</q>
</ns1:doGoogleSearch>
</soap-env:Body>
</soap-env:Envelope>
When I run the same code inside of a servlet in Weblogic 8.1SP1, the envelope
looks like this:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header/>
<env:Body>
<ns1:doGoogleSearch>
<q>shrdlu winograd maclisp teletype</q>
</ns1:doGoogleSearch>
</env:Body>
</env:Envelope>
Can anyone tell me why the namespace URI is not showing up in the method name?
(i.e. Why is it <ns1:doGoogleSearch> instead of <ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch">)
Is there a problem with the SAAJ implementation that requires a patch? This
is just one of many problems I am having. Any help would be appreciated.
Thanks.
Mike
Hi Michael,
I believe this has already been reported and patched. Contact our award
winning support (http://support.bea.com or support#bea.com) and
reference CR102959.
A workaround is to use SOAPElement.addNamespaceDeclaration()
Thanks,
Bruce
Michael Hamel wrote:
>
Hi. If I use SAAJ 1.1.1 from JWSDP1.1 to create a SOAP envelope like this:
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPElement bodyElement = body.addChildElement(envelope.createName("doGoogleSearch",
"ns1", "urn:GoogleSearch"));
bodyElement.addChildElement("q").addTextNode("shrdlu winograd maclisp teletype");
message.saveChanges();
I get a SOAP envelope that looks like this:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header></soap-env:Header>
<soap-env:Body>
<ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch">
<q>shrdlu winograd maclisp teletype</q>
</ns1:doGoogleSearch>
</soap-env:Body>
</soap-env:Envelope>
When I run the same code inside of a servlet in Weblogic 8.1SP1, the envelope
looks like this:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header/>
<env:Body>
<ns1:doGoogleSearch>
<q>shrdlu winograd maclisp teletype</q>
</ns1:doGoogleSearch>
</env:Body>
</env:Envelope>
Can anyone tell me why the namespace URI is not showing up in the method name?
(i.e. Why is it <ns1:doGoogleSearch> instead of <ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch">)
Is there a problem with the SAAJ implementation that requires a patch? This
is just one of many problems I am having. Any help would be appreciated.
Thanks.
Mike

SAML Token Profile Policies Issues

Hi all
i want to secure a Web service using SAML Token Profile Policies. I am using Wssp1.2-2007-Saml2.0-SenderVouches-Wss1.1.xml Policy.
I have Configured SAML 2.0 Identity Assertion Provider in my WebLogic Server. And added Identity Provider partner.
I gave the Issues as http://com.example.idp/AssertingParty
Below is the Soap Request Which i send to my Webservice.
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" env:mustUnderstand="1">
<saml:Assertion
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_15931837d93e95e7e7ffbaa038ad4942"
IssueInstant="2013-04-26T15:20:24.021Z" Version="2.0">
<saml:Issuer>http://com.example.idp/AssertingParty</saml:Issuer>
<saml:Subject>
<saml:NameID Format="NameID">weblogic_sp</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:sender-vouches"/>
</saml:Subject>
<saml:Conditions NotBefore="2013-04-26T15:24:14.021Z" NotOnOrAfter="2013-04-26T15:50:24.021Z"/>
<saml:AuthnStatement>
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Attribute Name="Roles">
<saml:AttributeValue>Administrators</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</wsse:Security>
</env:Header>
<env:Body/>
</env:Envelope>
I am Getting the below error.
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<env:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<faultcode>wsse:InvalidSecurityToken</faultcode>
<faultstring>Invalid SAML token on CCS?Invalid SAML token when samlAsst= null</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
I turned on the Verbose in the Weblogic server and Got the Below log when i invoke the Web Service.
<WSEE:24>Created<SoapMessageContext.<init>:48>
<WSEE:24>set Message called: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl#1d36368<SoapMessageContext.setMessage:65>
<WSEE:24>Parsed header {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security: <name={http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security> <role=null> <mustUnderstand=true><SoapMsgHeaders.parseHeaders:202>
<WSEE:24>set Message called: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl#1d36368<SoapMessageContext.setMessage:65>
<WSEE:24>Parsed header {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security: <name={http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security> <role=null> <mustUnderstand=true><SoapMsgHeaders.parseHeaders:202>
<WSEE:24>tokenType: null, cred: [saml:Assertion: null], privkey: null<SAMLCredentialImpl.<init>:107>
<WSEE:24>Class of cred is: class com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl<SAMLCredentialImpl.<init>:108>
<WSEE:24>Instantiating SAMLAssertionInfoFactory<SAMLCredentialImpl.<init>:113>
<WSEE:24>Getting SAMLAssertionInfo from DOM Element of CSS<SAMLCredentialImpl.<init>:141>
<WSEE:24>Got erroron on SAMLAssertionInfo from DOM Element of CSS, msg =[Security:098517]Failed to get SAML assertion info: Unable to construct SAML 1.1/2.0 Schema object, can not perform validation.<SAMLCredentialImpl.<init>:152>
Please let me if i am doing any thing wrong.
Thanks
Ranjith

Categories

Resources