Hi Ruchit,

At last fine tuning something at Tibco Server end I was able to solve that
exception, as there were some problems with certificate signing.Now i am
getting a different error.

I tried my best to include namespace in body variables but failed. I am
listing my problem, if somebody can help us because I doubt whether this is
possible or not. I am using Axis 1.4 and wss4j 1.5.

When I am calling service without security I get following SOAP Body:

<soapenv:Body>

<ns1:Request xmlns:ns1="http://exampleuri.org/SimplePayload.xsd";>

<ns1:FirstName>Mark</ns1:FirstName>

<ns1:LastName>Joe</ns1:LastName>

</ns1:Request>

</soapenv:Body>

Notice that both FirstName and LastName are prefixed by ns1.

When I enable security I get following SOAP Body:

<soapenv:Body>

<ns1:Request 
xmlns:ns1=http://exampleuri.org/SimplePayload.xsd<http://tempuri.org/SimplePayload.xsd>

xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
wsu:Id="id-19658898">

<FirstName>Mark</FirstName>

<LastName>Joe</LastName>

</ns1:Request>

</soapenv:Body>

Notice there's no prefix before FirstName and LastName .

For security, I am just signing the message payload. Following is the Wss4j
Settings:

WSDoAllSender sender = *new* WSDoAllSender();

sender.setOption(WSHandlerConstants.*SIG_PROP_FILE*,"crypto.properties" );

sender.setOption(WSHandlerConstants.*SIG_KEY_ID*, "DirectReference");

sender.setOption(WSHandlerConstants.*ACTION*,WSHandlerConstants.*SIGNATURE*
);

sender.setOption(WSHandlerConstants.*SIG_ALGO*,WSConstants.*RSA*);

sender.setOption(WSHandlerConstants.*USER*, "clientkey");

sender.setOption(WSHandlerConstants.*PW_CALLBACK_CLASS*,

PWCallBackImpl.*class*);

sender.setOption(WSHandlerConstants.*SIGNATURE_PARTS*,"{Element}{http://*
exampleuri.org*/SimplePayload.xsd}Request");

WSDoAllReceiver recv = *new* WSDoAllReceiver();

recv.setOption(WSHandlerConstants.*SIG_PROP_FILE*, "crypto.properties");

recv.setOption(WSHandlerConstants.*ACTION*, WSHandlerConstants.*SIGNATURE*
);

recv.setOption(WSHandlerConstants.*SIG_KEY_ID*, "DirectReference");

recv.setOption(WSHandlerConstants.*USER*, "serverkey");

recv.setOption(WSHandlerConstants.*PW_CALLBACK_CLASS*,PWCallBackImpl.*class
*);

recv.setOption(WSHandlerConstants.*SIGNATURE_PARTS*,"{Element}{http://*
exampleuri.org*/SimplePayload.xsd}Response");

Following is my Call settings:

org.apache.axis.description.OperationDesc oper;

org.apache.axis.description.ParameterDesc param;

oper = *new* org.apache.axis.description.OperationDesc();
oper.setName("SimpleRequest");

param = *new* org.apache.axis.description.ParameterDesc(*new*
javax.xml.namespace.QName("http://tempuri.org/SimplePayload.xsd";, "Request"),
org.apache.axis.description.ParameterDesc.*IN*, *new*
javax.xml.namespace.QName("http://*exampleuri.org*/SimplePayload.xsd";,
"RequestType"),

servicetest.withsecurity.org.tempuri.SimplePayload_xsd.RequestType.*class*,
*false*, *true*);

oper.addParameter(param);

oper.setReturnType(*new* javax.xml.namespace.QName("http://*exampleuri.org*
/SimplePayload.xsd", "ReturnType"));

oper.setReturnClass(
servicetest.withsecurity.org.tempuri.SimplePayload_xsd.ReturnType.*class*);

oper.setReturnQName(*new* javax.xml.namespace.QName("http://*exampleuri.org*
/SimplePayload.xsd", "Return"));

oper.setStyle(org.apache.axis.constants.Style.*DOCUMENT*);

oper.setUse(org.apache.axis.constants.Use.*LITERAL*);

*_operations*[0] = oper;

org.apache.axis.client.Call _call = createCall();

_call.setPassword("123456");

_call.setOperation(*_operations*[0]);

_call.setUseSOAPAction(*true*);

_call.setSOAPActionURI(
"/WS_Security/SimpleService.serviceagent/SimpleServiceInterfaceEndpoint1/SimpleRequest"
);

_call.setEncodingStyle(http://schemas.xmlsoap.org/soap/envelope/);

_call.setProperty(org.apache.axis.client.Call.*SEND_TYPE_ATTR*, Boolean.*
FALSE*);

_call.setProperty(org.apache.axis.AxisEngine.*PROP_DOMULTIREFS*, Boolean.*
FALSE*);

_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.*SOAP11_CONSTANTS*);

_call.setOperationName(*new* javax.xml.namespace.QName("http://*
exampleuri.org*/SimplePayload.xsd", "SimpleRequest"));

_call.setClientHandlers(sender, recv);

setRequestHeaders(_call);

setAttachments(_call);

*try* {

java.lang.Object _resp = _call.invoke(*new* java.lang.Object[]
{messagePart});

*I want namespaces specified explicitly for both FirstName and LastName.*
**
*Please help.*
**
**

Reply via email to