How to use authentication with the SOAPClient ?
simplex-software Feb 20, 2012 9:48 AMGreetings,
Using ESB 4.10 included in JBoss SOA-P 5.2.0. I have an ESB service exposed as a web service. It doesn't require authentication. When it is called, this web service invokes another external web service, which requires HTTP basic authentication. I'm using the soapUI GUI to generate a soap request and to send it to the EBWS. Running the test raises HTTP 401. soapUI has a tab in which one can provide credentials for the HTTP basic authentication and it creates an authorization header. But this request is sent to the EBWS, who doesn't require it, and it doesn't seem to be propagated to the external web service. I also tried to insert SOAP level security but I still get HTTP 401. Here is the jboss-esb.xml file:
<services>
<service category="TestEsbServices" description="Test to consume SAP web services" invmScope="GLOBAL" name="Test01">
<actions faultXsd="/fault.xsd" inXsd="/request.xsd" outXsd="/response.xsd" validate="true">
<action class="be.ovam.tests.TestAction" name="testAction" />
<action class="be.ovam.tests.TestMapRequestAction" name="test-request-mapper" />
<action class="org.jboss.soa.esb.actions.SystemPrintln" name="PrintBefore">
<property name="message" />
<property name="printfull" value="true" />
</action>
<action class="org.jboss.soa.esb.actions.soap.SOAPClient" name="soapui-client-action">
<property name="wsdl" value="http://sv102024.ovam.be:8000/sap/bc/srt/rfc/sap/ztestgetdatasap/062/ztestgetdatasap/ztestgetdatasap" />
<property name="SOAPAction" value="getProject1" />
<property name="responseAsOgnlMap" value="true" />
</action>
<action class="be.ovam.tests.TestMapResponseAction" name="test-response-mapper" />
</actions>
</service>
</services>
And here is the SOAP:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:proj="http://www.ovam.be/project" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
<soapenv:Header>
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>extcapdev01</wsse:Username>
<wsse:Password>sebadew1</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<proj:projectRequest>
<proj:projectName>?</proj:projectName>
</proj:projectRequest>
</soapenv:Body>
</soapenv:Envelope>
And here is the exception:
15:47:28,337 ERROR [WsdlContext] Loading of definition failed for [http://sv102024.ovam.be:8000/sap/bc/srt/rfc/sap/ztestgetdatasap/062/ztestgetdatasap/ztestgetdatasap]; org.apache.commons.httpclient.HttpException: Received status code '401' on WSDL HTTP (GET) request: 'http://sv102024.ovam.be:8000/sap/bc/srt/rfc/sap/ztestgetdatasap/062/ztestgetdatasap/ztestgetdatasap'.
15:47:28,338 ERROR [STDERR] org.apache.commons.httpclient.HttpException: Received status code '401' on WSDL HTTP (GET) request: 'http://sv102024.ovam.be:8000/sap/bc/srt/rfc/sap/ztestgetdatasap/062/ztestgetdatasap/ztestgetdatasap'.
15:47:28,338 ERROR [STDERR] at org.jboss.soa.esb.services.soapui.EsbWsdlLoader.load(EsbWsdlLoader.java:72)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:62)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:412)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:403)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.cacheWsdl(WsdlLoader.java:116)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext$Loader.construct(WsdlContext.java:200)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:45)
15:47:28,338 ERROR [STDERR] at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:111)
15:47:28,338 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
15:47:28,340 ERROR [WsdlProject] Error importing wsdl: org.apache.commons.httpclient.HttpException: Received status code '401' on WSDL HTTP (GET) request: 'http://sv102024.ovam.be:8000/sap/bc/srt/rfc/sap/ztestgetdatasap/062/ztestgetdatasap/ztestgetdatasap'.
15:47:28,340 ERROR [STDERR] org.apache.commons.httpclient.HttpException: Received status code '401' on WSDL HTTP (GET) request: 'http://sv102024.ovam.be:8000/sap/bc/srt/rfc/sap/ztestgetdatasap/062/ztestgetdatasap/ztestgetdatasap'.
15:47:28,341 ERROR [STDERR] at org.jboss.soa.esb.services.soapui.EsbWsdlLoader.load(EsbWsdlLoader.java:72)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:62)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:412)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:403)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.cacheWsdl(WsdlLoader.java:116)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext$Loader.construct(WsdlContext.java:200)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:45)
15:47:28,341 ERROR [STDERR] at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:111)
15:47:28,341 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
Many thanks in advance for your help.
Nicolas