Reputation: 6602
I am implementing webservice client throught the given 3rd-party wsdl, I wanted to ensure that I am able to send the SOAP request directly, so I generated request using soapUI, sent 2 parameters:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:alm="http://www.xxxxx.com/services/2011/10/Thirdparty" xmlns:ns="http://www.xxxxx.com/AlmedaDataDistribution/2011/10">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>dummyUsername</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">dummyPassword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<alm:method>
<ns:param1>dummyParam1</ns:param1>
<ns:param1>dummyParam2</ns:param2>
</alm:method>
</soapenv:Body>
</soapenv:Envelope>
got response like following, seems ok:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<methodResponse xmlns="http://www.xxxxx.com/services/2011/10/Thirdparty">
<theResponse xmlns="http://www.xxxxx.com/Thirdparty/2011/10">
<asdf>abc-1</asdf>
<qwer>123-1</qwer>
</theResponse>
<theResponse xmlns="http://www.xxxxx.com/Thirdparty/2011/10">
<asdf>abc-2</asdf>
<qwer>123-2</qwer>
</theResponse>
</methodResponse>
</soapenv:Body>
</soapenv:Envelope>
Then I am starting to generate webservice client from the WSDL (link like this: https://www.xxxxx.com/ThirdpartyService?wsdl) Since eclipse does not support generation from HTTPS link directly, so I downloaded the .wsdl and the depending .xsd files and generated the client locally. After generation, I modified the client, added the username and password through apache-cxf API
ThirdpartyService ss = new ThirdpartyService();
ThirdpartyServicePortType port = ss.getThirdpartyServiceSOAP11PortHttps();
Client client = ClientProxy.getClient(port);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
Map<String,Object> outProps = new HashMap<String,Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "dummyusername");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PASSWORD_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordCallback.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
ss.method(param1,param2);
however when I started to run the client, I got following strange Exception (seems nothing to do with the WS-Security stuff):
org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl handleNoRegisteredBuilder WARNING: No assertion builder for type {http://www.xxxxx.com/module/throttle}ServiceThrottleAssertion registered. Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives can be satisfied.
What else I am able to tell is my dev-env:
WinXP SP3 Java 1.6.0_027 Apache-CXF 2.6.0 Tomcat 6.0.35 eclipse Indigo SR1 Dynamic Web Module 2.5
I'd be grateful for any clue and help.
Upvotes: 2
Views: 2011
Reputation: 6602
I forget to tell that I implemented a client using axis1.4 accidentally in the meantime and solved my problem temporarily. But I still don't understand why is this webservice (seems) framework dependent.
Upvotes: 0