On Mar 16, 2014, at 1:02 PM, Kaji Yuy <[email protected]> wrote:

> Is it possible to generate the JAXB mapping classes in a way that would
> allow the client to consume the response without a namespace?

This “looks” like the root element in the soap:Body.   If that’s the case, it 
would be agains SOAP spec to NOT have a namespace on that element.  

That said, you can use the 
https://cxf.apache.org/docs/transformationfeature.html to have it map elements 
in the default namespace to the “proper” namespace.

Dan


> 
> The webservice I'm consuming provides a wsdl which defines a namespace for
> all of its elements.  The response returned by the webservice does not
> contain any namespaces.  When I attempt to convert the response (which is a
> Node object) by executing the following
> 
> AuthorizeUser aur2 = (AuthorizeUser) jaxbUnmarshaller.unmarshal(n);
> 
> I get the following:
> 
> javax.xml.bind.UnmarshalException: unexpected element (uri:"",
> local:"AuthorizeUser"). Expected elements are <{
> http://clearstar.net/Gateway/User}AddCustomerAccess>,<{
> http://clearstar.net/Gateway/User}AddCustomerAccessResponse>,<{
> http://clearstar.net/Gateway/User}AddRestrictionSvcGrps>,<{
> http://clearstar.net/Gateway/User}AddRestrictionSvcGrpsResponse>,<{
> http://clearstar.net/Gateway/User}AuthorizeCustomerGroupUser>,<{
> http://clearstar.net/Gateway/User}AuthorizeCustomerGroupUserResponse>,<{
> http://clearstar.net/Gateway/User}AuthorizeUser>,<{
> http://clearstar.net/Gateway/User}AuthorizeUserResponse>,<{
> http://clearstar.net/Gateway/User}CreateMFAUser>,<{
> http://clearstar.net/Gateway/User}CreateMFAUserResponse>,<{
> http://clearstar.net/Gateway/User}CreateUser>,<{
> http://clearstar.net/Gateway/User}CreateUserResponse>,<{
> http://clearstar.net/Gateway/User}DeleteRestrictionSvcGrps>,<{
> http://clearstar.net/Gateway/User}DeleteRestrictionSvcGrpsResponse>,<{
> http://clearstar.net/Gateway/User}DeleteWebUserAuthIPAddress>,<{
> http://clearstar.net/Gateway/User}DeleteWebUserAuthIPAddressResponse>,<{
> http://clearstar.net/Gateway/User}EditMFAUser>,<{
> http://clearstar.net/Gateway/User}EditMFAUserResponse>,<{
> http://clearstar.net/Gateway/User}EditUser>,<{
> http://clearstar.net/Gateway/User}EditUserResponse>,<{
> http://clearstar.net/Gateway/User}ForgotPassword>,<{
> http://clearstar.net/Gateway/User}ForgotPasswordResponse>,<{
> http://clearstar.net/Gateway/User}GetAvailableInternalSuppliers>,<{
> http://clearstar.net/Gateway/User}GetAvailableInternalSuppliersResponse>,<{
> http://clearstar.net/Gateway/User}GetMFAUserDetail>,<{
> http://clearstar.net/Gateway/User}GetMFAUserDetailResponse>,<{
> http://clearstar.net/Gateway/User}GetUserDetail>,<{
> http://clearstar.net/Gateway/User}GetUserDetailResponse>,<{
> http://clearstar.net/Gateway/User}GetUserRestriction>,<{
> http://clearstar.net/Gateway/User}GetUserRestrictionResponse>,<{
> http://clearstar.net/Gateway/User}GetUserRestrictionsSvcGrps>,<{
> http://clearstar.net/Gateway/User}GetUserRestrictionsSvcGrpsResponse>,<{
> http://clearstar.net/Gateway/User}GetUsers>,<{
> http://clearstar.net/Gateway/User}GetUsersByType>,<{
> http://clearstar.net/Gateway/User}GetUsersByTypeResponse>,<{
> http://clearstar.net/Gateway/User}GetUsersResponse>,<{
> http://clearstar.net/Gateway/User}GetWebUserAuthIPAddresses>,<{
> http://clearstar.net/Gateway/User}GetWebUserAuthIPAddressesForConfiguration
>> ,<{
> http://clearstar.net/Gateway/User}GetWebUserAuthIPAddressesForConfigurationResponse
>> ,<{http://clearstar.net/Gateway/User}GetWebUserAuthIPAddressesResponse>,<{
> http://clearstar.net/Gateway/User}RemoveCustomerAccess>,<{
> http://clearstar.net/Gateway/User}RemoveCustomerAccessResponse>,<{
> http://clearstar.net/Gateway/User}SetUserRestriction>,<{
> http://clearstar.net/Gateway/User}SetUserRestrictionResponse>,<{
> http://clearstar.net/Gateway/User}SetWebUserAuthIPAddress>,<{
> http://clearstar.net/Gateway/User}SetWebUserAuthIPAddressResponse>,<{
> http://clearstar.net/Gateway/User}SuspendUser>,<{
> http://clearstar.net/Gateway/User}SuspendUserResponse>,<{
> http://clearstar.net/Gateway/User}UnsuspendUser>,<{
> http://clearstar.net/Gateway/User}UnsuspendUserResponse>,<{
> http://clearstar.net/Gateway/User}UpdateHiddenProfFieldsSetting>,<{
> http://clearstar.net/Gateway/User}UpdateHiddenProfFieldsSettingResponse>,<{
> http://clearstar.net/Gateway/User}UpdatePassword>,<{
> http://clearstar.net/Gateway/User}UpdatePasswordResponse>
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:609)
> 
> I'm checking to see if I can get a response with the appropriate namespaces
> but there does not appear to be any options in the request to specify the
> format of the response.
> 
> Thanks!
> 
> 
> 
> 
> 
> 
> On Thu, Mar 13, 2014 at 10:48 AM, Mark Streit <[email protected]> wrote:
> 
>> Have you taken a look at Glen Mazza's JAX-WS tutorials like this one?
>> 
>> http://www.jroller.com/gmazza/entry/web_service_tutorial
>> 
>> Full list here: http://www.jroller.com/gmazza/entry/blog_article_index
>> 
>> Mark
>> 
>> On Wed, Mar 12, 2014 at 8:36 PM, Kaji Yuy <[email protected]> wrote:
>> 
>>> Hi,
>>>  I generated a client via wsdl2java maven plugin successfully.  When I
>> try
>>> to execute the following code snippet I get the error below:
>>> 
>>> try{
>>> logger.info("customer wsdl location: "+ Customer.WSDL_LOCATION);
>>>    Customer customerService = new Customer(Customer.WSDL_LOCATION,
>>> SERVICE_NAME);
>>>    CustomerSoap customerPort = customerService.getCustomerSoap();
>>>    GetAllDisclaimersResult disclaimerResult =
>>> customerPort.getAllDisclaimers(csc.getUsername(), csc.getPassword(),
>>> csc.getBoid(), csc.getCustomerId());
>>> 
>>>    List<Object> objects = disclaimerResult.getContent();
>>> 
>>>    for(Object curr: objects){
>>>     logger.info("Returned a disclaimer-- no idea what's inside"+curr);
>>>    }
>>> 
>>> }
>>> catch (Exception e) {
>>>    logger.error("An exception occurred, exiting", e);
>>> }
>>> 
>>> 
>>> 
>>> 
>> ==================================================================================
>>> org.apache.cxf.interceptor.Fault: Could not send Message.
>>> at
>>> 
>>> 
>> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
>>> at
>>> 
>>> 
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:296)
>>> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:242)
>>> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>>> at
>> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:178)
>>> at $Proxy50.getAllDisclaimers(Unknown Source)
>>> at
>>> 
>>> 
>> com.crowdtrust.ws.verification.client.ClearStarCustomerClient.getDisClaimer(ClearStarCustomerClient.java:35)
>>> at
>>> 
>>> 
>> com.crowdtrust.ws.verification.client.ClearStarCustomerClientTest.clearStarCustomerClientExecute(ClearStarCustomerClientTest.java:38)
>>> 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:597)
>>> at
>>> 
>>> 
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
>>> at
>>> 
>>> 
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>>> at
>>> 
>>> 
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
>>> at
>>> 
>>> 
>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
>>> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
>>> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
>>> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
>>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
>>> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
>>> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>>> at
>>> 
>>> 
>> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
>>> at
>>> 
>>> 
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>> at
>>> 
>>> 
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>> at
>>> 
>>> 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>> at
>>> 
>>> 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>> at
>>> 
>>> 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>> at
>>> 
>>> 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>> Caused by: java.net.ConnectException: Connection refused: connect
>>> at java.net.PlainSocketImpl.socketConnect(Native Method)
>>> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>>> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>>> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>>> at java.net.Socket.connect(Socket.java:529)
>>> at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
>>> at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
>>> at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
>>> at sun.net.www.http.HttpClient.<init>(HttpClient.java:227)
>>> at sun.net.www.http.HttpClient.New(HttpClient.java:300)
>>> at sun.net.www.http.HttpClient.New(HttpClient.java:317)
>>> at
>>> 
>>> 
>> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
>>> at
>>> 
>>> 
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
>>> at
>>> 
>>> 
>> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
>>> at
>>> 
>>> 
>> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
>>> at
>>> 
>>> 
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1834)
>>> at
>>> 
>>> 
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1792)
>>> at
>>> 
>>> 
>> org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42)
>>> at
>>> 
>>> 
>> org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
>>> at
>>> 
>>> 
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1852)
>>> at
>> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>>> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
>>> at
>>> 
>>> 
>> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>>> ... 36 more
>>> 
>>> 
>>> I've been searching for possible reasons for the refused connection but
>> the
>>> exception is pretty vague.  Does any one have any suggestions as to how I
>>> might be able to resolve this?
>>> 
>>> Thanks,
>>> Kaji
>>> 
>> 

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to