samedi 26 mars 2016

Jax ws client giving error in jboss While it works in jetty

My requirement is request should be gzip and connection can not be keep alive. so it should be close. Enviroment is Jboss as 7.1.0 .When i have only following in binding provider iam getting proper response:

provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,endpoint);        provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,userName);
    provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,password);

Request Payload as:

Address: http://ift.tt/1Ru8vO6 Encoding: UTF-8 Content-Type: text/xml Headers: {Accept=[*/*], Authorization=[Basic VW5pdmVyc2FsIEFQSS91QVBJODIxMjMzODY2MC0xYjI3Mzg2Zjp3ezJDTm99OT03], SOAPAction=["http://localhost:8080/kestrel/AirService"]}  Payload:/*some xml request*/

Response Payload as:

    Response-Code: 200 Encoding: ISO-8859-1 Content-Type: text/xml Headers: {connection=[close], Content-Language=[en-US], content-type=[text/xml], Date=[Sat, 26 Mar 2016 12:45:23 GMT], DPTransID=[345f7114c1ee4d43a0c9f7381404d9bbCFXI52HD32], passwordEndDt=[20160311], SSLTerm=[216.113.131.96%3A443%2C%2FCF-COM_API%2FAPAC.UNIVERSAL-API.PP_443], Vary=[Accept-Encoding], X-Backside-Transport=[OK OK], X-Client-IP=[10.7.224.40], X-Global-Transaction-ID=[414155263], X-Powered-By=[Servlet/3.0]}
Messages: 
Message (saved to tmp file):
Filename: /tmp/cxf-tmp-221456/cos2214251956739057540tmp
(message truncated to 65536 bytes) and proper response.

But when i add follwing addition header property:

provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,endpoint);
    provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,userName);
    provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,password);
    HashMap<String,List<String>> httpHeaders =new HashMap<String,List<String>>(); 
    httpHeaders.put("Content-Encoding",Collections.singletonList("gzip"));
    httpHeaders.put("Accept-Encoding",Collections.singletonList("gzip"));
    httpHeaders.put("Connection",Collections.singletonList("close"));

Iam getting error as : com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'

Request Payload For Above Request is:

ID: 1
Address: http://ift.tt/1Ru8vO6
Encoding: UTF-8
Content-Type: text/xml
Headers: {Accept=[text/xml], Accept-Encoding=[gzip], Authorization=[Basic VW5pdmVyc2FsIEFQSS91QVBJODIxMjMzODY2MC0xYjI3Mzg2Zjp3ezJDTm99OT03], Connection=[close], Content-Encoding=[gzip], SOAPAction=["http://localhost:8080/kestrel/AirService"]}
Payload:/*some xml request(This is correct)*/

Response Payload:

    ID: 1
Response-Code: 500
Encoding: ISO-8859-1
Content-Type: application/json
Headers: {connection=[close], content-type=[application/json], Date=[Sat, 26 Mar 2016 12:26:04 GMT], DPTransID=[], Server=[Datapower XI52], X-Backside-Transport=[FAIL FAIL]}
Payload: { "errors":{ "error":{ "status":"500", "code":"Read error", "detail":"Read error" } } }
--------------------------------------
17:56:04,952 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (Thread-77) Interceptor for {http://ift.tt/1LPaopB has thrown exception, unwinding now: org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
    at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:237)
    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:795)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1493)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1401)
    at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
    at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:194)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:648)
    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:531)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:461)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:364)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
    at $Proxy64.service(Unknown Source) at com.ooc.engine.connectors.galileoUAPI.GalileoUAPISearchManager.getGalileoUAPIAvailabilityResponse(GalileoUAPISearchManager.java:408) [classes:]
    at com.ooc.engine.connectors.galileoUAPI.GalileoUAPISearchManager.getDomesticAvailability(GalileoUAPISearchManager.java:104) [classes:]
    at com.ooc.engine.connectors.galileoUAPI.GalileoUAPIDomesticRequestResponse.run(GalileoUAPIDomesticRequestResponse.java:49) [classes:]
    at com.ooc.engine.concurrency.OOCThreadPool$OOCThreadPoolRunnable.run(OOCThreadPool.java:20) [classes:]
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source) [concurrent.jar:]
    at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_16]
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639) [woodstox-core-asl-4.2.0.jar:4.2.0]
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052) [woodstox-core-asl-4.2.0.jar:4.2.0]
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134) [woodstox-core-asl-4.2.0.jar:4.2.0]
    at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1157) [woodstox-core-asl-4.2.0.jar:4.2.0]
    at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:138)
    ... 25 more




Aucun commentaire:

Enregistrer un commentaire