I am writing a client to a VMWare management web service. In working with the API, I made a mistake and a SOAP fault was thrown. That is not the problem. Instead of an WSDL generated exception class being thrown, I got what appears to be a validation error during parsing of the SOAP fault. I found someone who had a similar issue, but am not sure whether the problem is my code, the VMWare web service, or CXF. It would seem to me that if a web service operation would automatically utilize the schemas associated with the Service created from the WSDL. The previous mailing list poster said he solved the problem by using the Java.Net RI. However, the CXF web site listing the dependencies say the saaj being used is the Sun 1.3 RI. I am using Maven2 to pull in all the necessary libraries as well as building the client code from the WSDL. If anyone can shed some light on what the problem might be, I would be very grateful.

I did write some code to try and verify the schema associated with the web service:

List<ServiceInfo> serviceInfos = client.getEndpoint().getService().getServiceInfos();
       for (ServiceInfo serviceInfo : serviceInfos) {
           Schema schema = EndpointReferenceUtils.getSchema( serviceInfo );
LOG.info( "Schema = " + serviceInfo.getName().toString() + "\n" + schema.toString() );
       }

Its output was:

INFO: Creating Service {urn:vim2Service}VimService from WSDL: http://127.0.0.1:8080/sdk/vimService?wsdl 2008-01-23 16:56:08,780 INFO main SampleClient.afterPropertiesSet:158] Schema = [EMAIL PROTECTED]

The vimService.wsdl imports another WSDL, vim.wsdl, which contains most of the schema information. I was trying to verify that the imported schema was being properly associated with the service. You can see from above that the service/namespace is "urn:vim2Service". However, only one service/namespace is listed. The imported WSDL's schema's namespace, "urn:vim2", is not shown and I do not know whether this is a problem.

The previous posting can be found at the following URL:

http://mail-archives.apache.org/mod_mbox/incubator-cxf-user/200709.mbox/[EMAIL 
PROTECTED]

Below is the SOAP fault message that caused the exception and below that is the stack trace. Some relevant fragments from the imported WSDL are:

  <element name="InvalidRequestFault" type="vim2:InvalidRequest"/>

  <message name="InvalidRequestFaultMsg">
     <part name="fault" element="vim2:InvalidRequestFault" />
  </message>

The target namespace for these schema elements were xmlns:vim2="urn:vim2". SOAP fault message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
                 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <soapenv:Body>
       <soapenv:Fault>
           <faultcode>ServerFaultCode</faultcode>
           <faultstring>specSet</faultstring>
           <detail>
<InvalidRequestFault xmlns="urn:vim2" xsi:type="InvalidRequest"/>
           </detail>
       </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

I believe that this line is causing the problem, but should the contents of the <detail> element even be validated?

<InvalidRequestFault xmlns="urn:vim2" xsi:type="InvalidRequest"/>

Here is the stack trace:

Jan 23, 2008 4:56:09 PM com.sun.xml.messaging.saaj.soap.impl.FaultImpl setFaultCode SEVERE: SAAJ0140: No NamespaceURI, SOAP requires faultcode content to be a QName
java.lang.reflect.UndeclaredThrowableException
   at $Proxy32.retrieveProperties(Unknown Source)
at com.reflexsecurity.vmware.SampleClient.retrieveProperties(SampleClient.java:216)
   at com.reflexsecurity.vmware.SampleClient.main(SampleClient.java:82)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: No NamespaceURI, SOAP requires faultcode content to be a QName at com.sun.xml.messaging.saaj.soap.impl.FaultImpl.setFaultCode(FaultImpl.java:101) at com.sun.xml.messaging.saaj.soap.impl.FaultImpl.setFaultCode(FaultImpl.java:138) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:155)
   ... 8 more
Failed to retrieve properties.
2008-01-23 16:56:09,872 ERROR main SampleClient.main:96] Failed to retrieve properties
java.lang.reflect.UndeclaredThrowableException
   at $Proxy32.retrieveProperties(Unknown Source)
at com.reflexsecurity.vmware.SampleClient.retrieveProperties(SampleClient.java:216)
   at com.reflexsecurity.vmware.SampleClient.main(SampleClient.java:82)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: No NamespaceURI, SOAP requires faultcode content to be a QName at com.sun.xml.messaging.saaj.soap.impl.FaultImpl.setFaultCode(FaultImpl.java:101) at com.sun.xml.messaging.saaj.soap.impl.FaultImpl.setFaultCode(FaultImpl.java:138) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:155)
   ... 8 more

Process finished with exit code 0

Reply via email to