2

I am trying to connect to CMS implementing Core Service API from my JAVA application. I have used below configuration to access the CMS -

    Address: http://ServerName.****.*****.com/webservices/CoreService2013.svc/basicHttp
    Encoding: UTF-8
    Http-Method: POST
    Content-Type: text/xml
    Headers: {Accept=[*/*], Authorization=[Basic Z2lsLmZlcm5hbmRlczpTYXJvdmFyMTYxMDghISE=], SOAPAction=["http://www.sdltridion.com/ContentManager/CoreService/2013/ICoreService/GetApplicationIds"]}
    Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetApplicationIds xmlns="http://www.sdltridion.com/ContentManager/CoreService/2013" xmlns:ns2="http://www.sdltridion.com/ContentManager/R6" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns4="http://www.sdltridion.com/Security" xmlns:ns5="http://schemas.microsoft.com/2003/10/Serialization/"/></soap:Body></soap:Envelope>

Now using this config my code is running properly from Windows machine. But when I am deploying my application in Linux box and trying to access the CMS, it is giving below error -

    2015-11-19 15:09:11,989 WARN  PhaseInterceptorChain - Interceptor for {http://www.sdltridion.com/ContentManager/CoreService/2013}ICoreServiceService#{http://www.sdltridion.com/ContentManager/CoreService/2013}GetApplicationIds has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) ~[cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) [cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) [cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) [cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277) [cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) [cxf-rt-frontend-simple-3.1.2.jar:3.1.2]
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139) [cxf-rt-frontend-jaxws-3.1.2.jar:3.1.2]
        at com.sun.proxy.$Proxy88.getApplicationIds(Unknown Source) [na:na]
        at com.jio.epc.integration.Main.main(Main.java:22) [epc-main-1.0-SNAPSHOT.jar:na]
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with http://Servername.***.com/webservices/CoreService2013.svc/basicHttp
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1577) ~[cxf-rt-transports-http-3.1.2.jar:3.1.2]
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1532) ~[cxf-rt-transports-http-3.1.2.jar:3.1.2]
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330) ~[cxf-rt-transports-http-3.1.2.jar:3.1.2]
        at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56) ~[cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:215) ~[cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[cxf-core-3.1.2.jar:3.1.2]
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:652) ~[cxf-rt-transports-http-3.1.2.jar:3.1.2]
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ~[cxf-core-3.1.2.jar:3.1.2]
        ... 9 common frames omitted
Exception in thread "main" javax.xml.ws.WebServiceException: Could not send Message.
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:150)
        at com.sun.proxy.$Proxy88.getApplicationIds(Unknown Source)
        at com.jio.epc.integration.Main.main(Main.java:22)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with http://ServerName.***.com/webservices/CoreService2013.svc/basicHttp

Please Suggest.

  • Yes Pankaj! I have found the issue. Now from windows it is picking the right domain name but when i am trying to connect it from linux it is showing the wrong domain name. – Sayantan Basu Nov 19 '15 at 16:42
  • OK, thanks for update - I have moved my comment as an answer and you want to accept it as an answer if it makes sense – Pankaj Gaur Nov 20 '15 at 8:14
4

The error message itself suggest - '401: Unauthorized' which means the user you are using is not getting authorized. Verify that you are passing the right credentials from the client to authenticate the Core Service client.

| improve this answer | |
3

Maybe you tried this already, but have you seen my blog posts about connecting to Core Service from Java?

Source code available at:

Check out the CoreServiceFactory.java and Test.java

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.