How to digitally sign a SOAP request using the Eclipse proxy (axis 1.4) through WSS4J?

I have been provided with WSDL for a web service. Now I need to digitally sign this request. The previous developer used the Eclipse function to create proxy classes. Add WSDL to the project, then right-click on it, click "Web Service", then "Create Client."

This worked fine until we needed to digitally sign the request. I did a digging and it looks like Axis 1.4 does not allow you to sign requests. You can use WSS4J for this. I turned into WSS4j 1.5 in my project.

I do not understand how to digitally sign a request. Here is my existing code that uses proxy classes:

XiSecureWSServiceLocator service = new XiSecureWSServiceLocator();
service.setXiSecureWSServicePortEndpointAddress(paymetricPortAddress);
XiSecureWSPortType proxy = service.getXiSecureWSServicePort();
((Stub) proxy).setTimeout(paymetricTimeOutinMillisec);

SDecrypt_InputType sdi = new SDecrypt_InputType();
sdi.setStrToken(ccNumber);
sdi.setStrUserID(user);

SDecrypt_OutputType sdo = null;
sdo = proxy.pm_SingleDecrypt(sdi);

, . , :

public Message signSOAPEnvelope(SOAPEnvelope
unsignedEnvelope) throws Exception
{
  WSSignEnvelope signer = new WSSignEnvelope();
  String alias = "16c73ab6-b892-458f-abf5-2f875f74882e";
  String password = "security";
  signer.setUserInfo(alias, password);
  Document doc = unsignedEnvelope.getAsDocument();
  Document signedDoc = signer.build(doc, crypto);
  // Convert the signed document into a SOAP message.
  Message signedSOAPMsg =
  (org.apache.axis.Message)AxisUtil.toSOAPMessage(signedDoc);
  return signedSOAPMsg;
}

Soap , ?

+3
2

JavaRanch Thread WSS4J Axis.

, :

  • / wsdd
  • - EngineConfiguration, wsdd.
  • crypto.properties
  • , crypto.properties , , .

JavaRanch, .

. SOAP - Axis, , Axis 1.

/r/java, !

+2
0

All Articles