Skip to content

Instantly share code, notes, and snippets.

@klauern
Created August 9, 2011 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klauern/1134842 to your computer and use it in GitHub Desktop.
Save klauern/1134842 to your computer and use it in GitHub Desktop.
Error in CXF web service call.
Running com.me.RequestTest
Aug 10, 2011 4:16:24 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://service.something.net/xml}QueryService from WSDL: file://C:/mydocs/Work/project/my-service.wsdl
Aug 10, 2011 4:16:50 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://service.something.net/xml}QueryService#{http://service.something.net/xml}QueryRequest has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: "http://service.something.net/xml", the namespace on the "QueryResponse" element, is not a valid SOAP version.
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.readVersion(ReadHeadersInterceptor.java:115)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:141)
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:762)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1582)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1467)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1375)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:510)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:295)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy36.queryRequest(Unknown Source)
at com.me.RequestTest.shouldCallCXFServiceTest(MISORequestTest.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 42.625 sec <<< FAILURE!
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
Results :
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
Tests in error:
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
shouldCallCXFServiceTest(com.me.RequestTest)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:87)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="service" targetNamespace="http://service.something.net/xml"
xmlns:p="http://service.something.net/xml">
<wsdl:message name="SubmitRequestRequest">
<wsdl:part name="submit_request" element="p:SubmitRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="SubmitRequestResponse">
<wsdl:part name="submit_response" element="p:SubmitResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="QueryRequestRequest">
<wsdl:part name="body" element="p:QueryRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="QueryRequestResponse">
<wsdl:part name="body" element="p:QueryResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="QueryByTransactionRequest">
<wsdl:part name="parameters" type="p:QueryByTransactionType"></wsdl:part>
</wsdl:message>
<wsdl:message name="QueryByTransactionResponse">
<wsdl:part name="parameters" element="p:SubmitRequest"></wsdl:part>
</wsdl:message>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" >
<xsd:import
namespace="http://service.something.net/xml"
schemaLocation="My-XSD.xsd">
</xsd:import>
</xsd:schema>
</wsdl:types>
<wsdl:portType name="DART">
<wsdl:operation name="SubmitRequest">
<wsdl:input message="p:SubmitRequestRequest"></wsdl:input>
<wsdl:output message="p:SubmitRequestResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="QueryRequest">
<wsdl:input message="p:QueryRequestRequest"></wsdl:input>
<wsdl:output message="p:QueryRequestResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="QueryByTransaction">
<wsdl:input message="p:QueryByTransactionRequest"></wsdl:input>
<wsdl:output message="p:QueryByTransactionResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SubmitBinding" type="p:DART">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="SubmitRequest">
<soap:operation
soapAction="/xml/submit" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="QueryBinding" type="p:DART">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="QueryRequest">
<soap:operation soapAction="/xml/query" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="QueryTransactionBinding" type="p:DART">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="QueryByTransaction">
<soap:operation soapAction="/xml/queryByTransaction" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DARTService">
<wsdl:port name="SubmitPort" binding="p:SubmitBinding">
<soap:address location="https://server/xml/submit" />
</wsdl:port>
<wsdl:port name="QueryPort" binding="p:QueryBinding">
<soap:address location="https://server/xml/query" />
</wsdl:port>
<wsdl:port name="QueryByTransactionPort" binding="p:QueryTransactionBinding">
<soap:address
location="https://server/xml/queryByTransaction" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
@klauern
Copy link
Author

klauern commented Aug 11, 2011

I had only the .xsd file to go with, and the documentation from the vendor describing the couple endpoints to point at for the service. Since I didn't have much else, I had to hand-craft a .wsdl out of it, and import the .xsd as the element types that I could send and receive responses back. If I hand-generate the SOAP envelope to any of those <soap:address> locations, things work, but trying to use CXF to do it is a bit more difficult, as can be shown with the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment