493: Undecipherable

-Blog-

-Projects-

-Urlaub-

-About me-

-RSS-

JAX-WS: ORA-31011

Dennis Guse

Today, I tried to do something useful for my bachelor thesis. I tried to query a Oracle 11G DBMS via a SOAP-based Webservice. Using the instruction from Andrea and Oracle I got the service up and running. The Webservice was reachable under http://localhost:8080/orawsv and presented it's wsdl via http://localhost:8080/orawsv?wsdl.

Now the trouble started: The URL from the Oracle HTTP-Server is secured via HTTP-Authentification. Ok so I downloaded the WSDL and created the stubs from a local file with the JDK's wsimport. Now I needed to tell the Webservice Client Provider to authenticate if necessary:

1 ORAWSVPortType port = new ORAWSVService().getORAWSVPort();
2 Map<String, Object>; requestCtx = ((BindingProvider) port).getRequestContext();
3 requestCtx.put(BindingProvider.USERNAME_PROPERTY, "user");
4 requestCtx.put(BindingProvider.PASSWORD_PROPERTY, "password");

The first test ended with a desaster:

Exception in thread "main" java.lang.IllegalArgumentException: faultCode argument for createFault was passed NULL at com.sun.xml.messaging.saaj.soap.ver11.SOAPFactory11Impl.createFault(SOAPFactory1_1Impl.java:56) at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178) at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:108) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:254) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:224) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:117) at $Proxy32.xmlFromQuery(Unknown Source) at productcatalogws.Main.main(Main.java:49) Java Result: 1

I couldn't make anything useful out of these messages. The only thing I found was a dead end: bug_id=6587659. So I started debugging: First view the SOAPMessages: I used the cool charles proxy.

Configuration for JAVA:

1 System.getProperties().put("proxySet", "true");
2 System.getProperties().put("proxyHost", "localhost");
3 System.getProperties().put("proxyPort", "8888");

After viewing the messages without noticing anything of interesst except: ORA-31011: XML parsing error, but without any reference to the Webservice.

I found a cool tool to use webservices: soapUI (you can do everything I needed using it!!) and queried the Oracle Webservice by hand. And it worked!

The problem was that the default JAX-WS Provider does send:

Content-Type: text/xml;charset="utf-8"

And the Oracle HTTP Server expects:

Content-Type: text/xml;charset=UTF-8

An example SOAPMessage (including the header):

 1 Authorization: Basic XXXXX
 2 Host: localhost:8080
 3 Content-Length: 314
 4 SOAPAction: "<a href="http://localhost:8080/orawsv">http://localhost:8080/orawsv</a>"
 5 User-Agent: Jakarta Commons-HttpClient/3.0.1
 6 Content-Type: text/xml;charset=UTF-8
 7 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oraw="http://xmlns.oracle.com/orawsv">
 8     <soapenv:Header>
 9         <soapenv:Body>
10             <oraw:query>
11                 <oraw:query_text type="SQL">SELECT * FROM PRODUCT</oraw:query_text>
12             </oraw:query>
13         <soapenv:Body>
14 </soapenv:Envelope>

The questions are: * Does JAX-WS something wrong during the request or is the DB Webservice the bad guy? * And why doesn't JAX-WS handle the SOAPfault correctly?

Used software: javac --version:

java version "1.6.004" Java(TM) SE Runtime Environment (build 1.6.004-b12) Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

Oracle 11G DBMS: Oracle Database 11 g Release 1 for 32-bit Windows.