cxf - Getting exception while Consuming https Webservice in mule -
i'm trying call https web service using cxf generated client proxies within mule. 99% of time,
caused by: org.apache.commons.httpclient.protocolexception: unbuffered entity enclosing request can not repeated. @ org.apache.commons.httpclient.methods.entityenclosingmethod.writerequestbody(entityenclosingmethod.java:487) @ org.apache.commons.httpclient.httpmethodbase.writerequest(httpmethodbase.java:2114) @ org.apache.commons.httpclient.httpmethodbase.execute(httpmethodbase.java:1096)*
the app has http inbound end point. mule java transformer tries call webservice using https using cxf generated client proxies. i'm running above said exception.
i've provided screenshot mule flow [http://i.stack.imgur.com/7x9wg.jpg]. appreciated!!
mule config xml
<cxf:jaxws-service serviceclass="test.service.https.testservice" doc:name="soap" configuration-ref="cxf_configuration" enablemulesoapheaders="false"/> <custom-transformer class="test.service.https.calllicenseservice" doc:name="calls https ws using cxf generated client proxies" encoding="utf-8" mimetype="text/plain"/> <logger message="success" level="info" doc:name="logger"/> <set-payload value="#['hello success']" doc:name="set payload"/> </flow>
transformer url wsdlurl = null; string serviceurl = "target_https_wsdl"; //this target https url
try { wsdlurl = new url(serviceurl); } catch (malformedurlexception e) { logger.getlogger(getclass()).info("", e); } auditlogserviceservice ss = new auditlogserviceservice(wsdlurl); auditloggingservice port = ss.getauditloggingserviceport(); ((bindingprovider) port).getrequestcontext().put(bindingprovider.endpoint_address_property, serviceurl.substring(0, serviceurl.length() - 5)); auditlogservicerequest request = new auditlogservicerequest(); request.setclientid("4"); request.setuserid("101"); request.seteventsubtype("1"); request.seteventtype("1"); auditlogmessage msg = new auditlogmessage(); msg.setmessage("hello test"); request.getlogmessages().add(msg); auditlogserviceresponse response = port.logevent(request); system.out.println(response.getmessage());
return response.getmessage();
first of if need consume webservice need put <cxf:jaxws-client serviceclass
instead of cxf:jaxws-client
...next step need use http outbound endpoint post external webservice ... pls refer following link :- http://www.mulesoft.org/documentation/display/current/consuming+web+services+with+cxf
one more thing .. need use java component instead of <custom-transformer class
..you need set payload before component ... mean need set payload before posting external webservice
Comments
Post a Comment