0

i am working on SOAP based web-services. i need to test a scenario, where if the webservice connection error occurs due to any network issue or login issue.

the problem here with apache cxf is no matter what exception occurs the webservice is throwing

 "java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1".

The error response code is returning 500 but the stacktrace show "UnsupportedOpertaionException". i can catch the exception and print the stack trace but i need to know whether its a connection error or some other different error. the error log is as follows

 ID: 12117
Response-Code: 500
Encoding: UTF-8
Content-Type: application/soap+xml; charset=utf-8
Headers: {connection=[close], Content-Length=[6380], content-type=[application/soap+xml; charset=utf-8], Date=[2015年2月27日 16:43:47 GMT], Server=[Microsoft-HTTPAPI/2.0]}
Payload: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault</a:Action><a:RelatesTo>urn:uuid:9f063eed-af54-4074-86cf-35f360a6e4d0</a:RelatesTo></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Receiver</s:Value><s:Subcode><s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)</s:Text></s:Reason><s:Detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>The wait operation timed out</Message><StackTrace i:nil="true"/><Type>System.ComponentModel.Win32Exception</Type></InnerException><Message>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)</Message><StackTrace> at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)&#xD;
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)&#xD;
 at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)&#xD;
 at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)&#xD;
 at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)&#xD;
 at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)&#xD;
 at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)&#xD;
 at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)&#xD;
 at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)&#xD;
 at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)&#xD;
 at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)&#xD;
 at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)&#xD;
 at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)&#xD;
 at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)&#xD;
 at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)&#xD;
 at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)&#xD;
 at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)&#xD;
 at System.Data.SqlClient.SqlConnection.Open()&#xD;
 at BB.Core.Libraries.Data.DataContext.Connect(IsolationLevel isolationLevel, Boolean useTransaction)&#xD;
 at BB.EBT.Libraries.Services.UniversalInterface2012.GetMissingData(String&amp; houseHoldId, Decimal&amp; cardNumber)&#xD;
 at BB.EBT.Libraries.Services.UniversalInterface2012.AddUpdateBenefits(String ActionCode, String CardNumber, String WICMISAccountID, String ReasonCode, List`1 MonthlyFoodBenefits, MessageHeader MessageHeader)&#xD;
 at SyncInvokeAddUpdateBenefits(Object , Object[] , Object[] )&#xD;
 at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;
 at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
 at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
 at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
 at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.Data.SqlClient.SqlException</Type></ExceptionDetail></s:Detail></s:Fault></s:Body></s:Envelope>
--------------------------------------]
java.lang.UnsupportedOperationException: This class does not support SAAJ 1.1
 at weblogic.webservice.core.soap.SOAPElementImpl.getNamespaceURI(SOAPElementImpl.java:496)
 at org.apache.cxf.jaxws.JaxWsClientProxy.createSoapFault(JaxWsClientProxy.java:208)
 at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:154)
 at $Proxy97.addUpdateBenefits(Unknown Source)
 at gov.mass.eos.web.service.wiccardclient.EWICCardServiceClient.addUpdateBenefits(EWICCardServiceClient.java:168)
 at gov.mass.eos.web.service.wiccardclient.EWICCardServiceClient.addBenefits(EWICCardServiceClient.java:132)
 at gov.mass.eos.web.controllers.ce.benefits.EBenefitPreparationUtils.processBenefitsIssue(EBenefitPreparationUtils.java:108)
 at gov.mass.eos.web.controllers.ce.benefits.EIssueController.issueBenefits(EIssueController.java:501)
 at sun.reflect.GeneratedMethodAccessor184377.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:138)
 at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:62)
 at javax.faces.component.UICommand.broadcast(UICommand.java:106)
 at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:110)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:184)
 at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:271)
 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:102)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
 at com.sun.identity.agents.filter.AmAgentBaseFilter.allowRequestToContinue(AmAgentBaseFilter.java:87)
 at com.sun.identity.agents.filter.AmAgentBaseFilter.doFilter(AmAgentBaseFilter.java:43)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
 at gov.mass.eos.web.servlet.filter.Log4jFilter.doFilter(Log4jFilter.java:138)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3242)
 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
[27 Feb 2015 11:43:46,700] [ERROR] [EosRTException] [This class does not support SAAJ 1.1]
gov.mass.eos.common.exception.EosRTException.

can some one guide me or help me in how to catch this specific connection error or error 500 in the try catch block.

Jens
69.6k15 gold badges107 silver badges133 bronze badges
asked Mar 12, 2015 at 20:05

2 Answers 2

1

The SAAJ API conforms to the Simple Object Access Protocol (SOAP) 1.1 and 1.2 specifications and the SOAP with Attachments specification. In your case xcf does not support the version of SOAP you're using.

answered Mar 12, 2015 at 20:14
Sign up to request clarification or add additional context in comments.

Comments

1

This response is a bit late but it worked for me in weblogic 11g without changing the servers' configuration (https://blogs.oracle.com/sravansarraju/entry/weblogic_saaj_version_problem_javalangunsupportedoperationexception_this_class_does_not_support_saaj).

Simply add SOAPConstants.SOAP_1_2_PROTOCOL when creating the SOAPMessage

SOAPMessage sm = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
answered Oct 18, 2016 at 17:26

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.