WSDoAllSender uses "getAsDocument(...)" to get the SOAP request as XML DOM to
be able
to process it. The involves "serialization" of the Java data types into XML.
The getAsDocument(...)
is an Axis 1 function thus WSS4J cannot do much about it. Did you check if
there is a known
issues with this function in Axis 1?
Regards,
Werener
________________________________
From: ext Vitali Heinrich [mailto:[email protected]]
Sent: Tuesday, June 23, 2009 7:46 AM
To: [email protected]
Subject: WSDoAllSender and Axis TypeMapping
Hi All,
I try to integrate wss4j in OFBiz. OFBiz uses Axis(1) 1.4 and all (web)
services are described by ofbiz engine. So I have no chance to create a .wsdd
file. But it´s not bad, because I can implement a client in code style. Now my
problem:
My service needs as input a Bean (for example MyBean). So I register it
in TypeMaping and it works fine.
But when I set WSDoAllSender as ClientHandler, MyBean could not be
finding in TypeMapping anymore.
Here some snippets:
service = new Service();
call = (Call) service.createCall();
call.setClientHandlers(new WSDoAllSender(), null);
call.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
call.setProperty(WSHandlerConstants.USER, "user");
call.setProperty(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
call.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,PasswordProvider.class.getName()
);
call.setProperty(WSHandlerConstants.SIG_PROP_FILE,
"client-provider.properties");
call.setProperty(WSHandlerConstants.MUST_UNDERSTAND, "0");
/* inputObject = my.package.MyBean */
/* inputObjectsName = "myBean" */
QName inputQName = new
QName(registerPrefix,inputObject.getClass().getName());
call.addParameter(inputObjectsName, inputQName, getMode("IN"));
vParams.add(inputObject);
call.registerTypeMapping(inputObject.getClass(),inputQName,
new
BeanSerializerFactory(inputObject.getClass(),inputQName),
new
BeanDeserializerFactory(inputObject.getClass(),inputQName));
call.invoke(vParams.toArray());
So if the client handler is not set, if works fine.
If it is set to WSDoAllSender I get this exception
AxisFault
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
<http://schemas.xmlsoap.org/soap/envelope/%7DServer.generalException>
faultSubcode:
faultString: WSDoAllSender: cannot get SOAP envlope from
messagejava.io.IOException: No serializer found for class my.package.MyBean in
registry org.apache.axis.encoding.typemappingdeleg...@d1e89e
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:WSDoAllSender
<http://xml.apache.org/axis/%7DstackTrace:WSDoAllSender> : cannot get SOAP
envlope from messagejava.io.IOException: No serializer found for class
my.package.MyBean in registry
org.apache.axis.encoding.typemappingdeleg...@d1e89e
at
org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:159)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:121)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
. . .
This exceptins ist throwing at this place of code
(WSDoAllSender.invoke):
/*
* If the message context property conatins a document then
this is
* a chained handler.
*/
SOAPPart sPart = (org.apache.axis.SOAPPart)
message.getSOAPPart();
if ((doc = (Document)
((MessageContext)reqData.getMsgContext())
.getProperty(WSHandlerConstants.SND_SECURITY)) ==
null) {
try {
doc = ((org.apache.axis.message.SOAPEnvelope) sPart
.getEnvelope()).getAsDocument();
} catch (Exception e) {
throw new AxisFault(
"WSDoAllSender: cannot get SOAP envlope
from message"
+ e);
}
}
Can anybody help me?
Does anybody have some experience in integrating wss4j in ofbiz?
Another question is:
Is it possible to integrate wss4j on server site without a XML file but
in code style like on the client site?