error when calling WCF webservice with authentication

One Star

error when calling WCF webservice with authentication

I am trying to use tWebServiceInput to call a web service implemented using Microsoft WCF, it is of HTTPs with authentication.
I used the Advanced setting to generate routines from the WSDL (https:// .....svc/metadata?WSDL. Here are the codes I put in the advanced tab of tWebServiceInput component:
===============================================
routines.BasicHttpBinding_IEnrollmentServiceStub stub = (routines.BasicHttpBinding_IEnrollmentServiceStub) new routines.EnrollmentServiceLocator().getBasicHttpBinding_IEnrollmentService();
stub.setUsername("user");
stub.setPassword("password");
routines.ResponseXYZ result = stub.getXYZ("request 123");
===============================================
I got the following exception:
=================================
Exception in component tWebServiceInput_2
AxisFault
faultCode: {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}InvalidSecurity
faultSubcode:
faultString: An error occurred when verifying security for the message.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:An error occurred when verifying security for the message.
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
disconnected
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
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)
at routines.BasicHttpBinding_IEnrollmentServiceStub.getProcessingStates(BasicHttpBinding_IEnrollmentServiceStub.java:537)
at enterpriseservices.istaenrollment_0_1.IstaEnrollment.tWebServiceInput_2Process(IstaEnrollment.java:313)
at enterpriseservices.istaenrollment_0_1.IstaEnrollment.runJobInTOS(IstaEnrollment.java:537)
at enterpriseservices.istaenrollment_0_1.IstaEnrollment.main(IstaEnrollment.java:403)
{http://xml.apache.org/axis/}hostname:6P0GLQ1-DEV-PC
An error occurred when verifying security for the message.
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFau
================================
Could some one tell me what I am missing or what the proper way to invoke such web service in Talend?
Thanks
Moderator

Re: error when calling WCF webservice with authentication

Hi,
org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied.

That's a non-standard policy assertion and not marked optional Thus, CXF doesn't know what to do with it. I suspect that is because of non-standard MS policy(should put your HTTPS credentials to auth).
Could you please check the tSetKeystore?
In addition that, is it working when you use tESBConsumer?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: error when calling WCF webservice with authentication

I am not sure how to make it work using eESBConsumer: where do I get the "payload" and "header" schema? Incidently, duing configuring eESBConsumer, I checked the"populate schema to repository on finish" checkbox, and I did not see schema generated anywhere in the repository, where should it be?
Also, are you suggesting the exception was caused by it requiring client certificate for HTTPS (hence the need of using tSetKeystore)?
I found the following link, if it is related to the implementation of tWebServiceInput component
http://stackoverflow.com/questions/12072500/apache-cxf-none-of-the-policy-alternatives-can-be-satisf...
thanks