You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jaybytez <ja...@yahoo.com> on 2011/02/17 19:15:28 UTC
CXFServlet and error-codes
I am trying to implement the recommendation in this article:
http://www.techper.net/2008/08/29/making-a-java-webapp-return-proper-soap-fault-responses/comment-page-1/
So that I can return predefined SOAP Fault Messages for certain HTTP Codes.
I have configured my web.xml file, but the code files are not returning. Is
there anything specific I need to do in CXF for accomplishing this? Or is
it more likely a WebLogic Server issue. Because my Soap Requests that
should create a 404 response (via my custom response) only keeps returning
the default 404.html.
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>CodeLookupUtilityService Endpoint</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/CodeLookupUtilityServiceWar-context.xml
classpath*:/CodeLookupUtilityServiceClientInt-context.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>soap</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<error-page>
<error-code>401</error-code>
<location>/soap-error-responses/401.soap</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/soap-error-responses/403.soap</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/soap-error-responses/404.soap</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/soap-error-responses/500.soap</location>
</error-page>
<error-page>
<error-code>503</error-code>
<location>/soap-error-responses/503.soap</location>
</error-page>
</web-app>
Sample File
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Service</faultcode>
<faultstring>404:Not Found</faultstring>
<detail>
<ex:msg xmlns:ex='http://healthnet.com/soa/frmwk/exception'>
The server has not found anything matching the Request-URI.
</ex:msg>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Thanks,
Jay
--
View this message in context: http://cxf.547215.n5.nabble.com/CXFServlet-and-error-codes-tp3389935p3389935.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXFServlet and error-codes
Posted by Daniel Kulp <dk...@apache.org>.
It kind of sounds like a weblogic thing to me. I would try dumping the war
into tomcat and seeing if that changes anything or not.
Dan
On Thursday 17 February 2011 1:15:28 PM jaybytez wrote:
> I am trying to implement the recommendation in this article:
>
> http://www.techper.net/2008/08/29/making-a-java-webapp-return-proper-soap-f
> ault-responses/comment-page-1/
>
> So that I can return predefined SOAP Fault Messages for certain HTTP Codes.
> I have configured my web.xml file, but the code files are not returning.
> Is there anything specific I need to do in CXF for accomplishing this? Or
> is it more likely a WebLogic Server issue. Because my Soap Requests that
> should create a 404 response (via my custom response) only keeps returning
> the default 404.html.
>
> web.xml
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd">
>
>
> <web-app>
> <display-name>CodeLookupUtilityService Endpoint</display-name>
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
> <param-value>/WEB-INF/CodeLookupUtilityServiceWar-context.xml
>
> classpath*:/CodeLookupUtilityServiceClientInt-context.xml</param-value>
> </context-param>
>
> <listener>
> <listener-class>
> org.springframework.web.context.ContextLoaderListener
> </listener-class>
> </listener>
>
> <servlet>
> <servlet-name>CXFServlet</servlet-name>
> <servlet-class>
> org.apache.cxf.transport.servlet.CXFServlet
> </servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> <mime-mapping>
> <extension>soap</extension>
> <mime-type>text/xml</mime-type>
> </mime-mapping>
>
> <error-page>
> <error-code>401</error-code>
> <location>/soap-error-responses/401.soap</location>
> </error-page>
> <error-page>
> <error-code>403</error-code>
> <location>/soap-error-responses/403.soap</location>
> </error-page>
> <error-page>
> <error-code>404</error-code>
> <location>/soap-error-responses/404.soap</location>
> </error-page>
> <error-page>
> <error-code>500</error-code>
> <location>/soap-error-responses/500.soap</location>
> </error-page>
> <error-page>
> <error-code>503</error-code>
> <location>/soap-error-responses/503.soap</location>
> </error-page>
> </web-app>
>
> Sample File
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <soap:Fault>
> <faultcode>soap:Service</faultcode>
> <faultstring>404:Not Found</faultstring>
> <detail>
> <ex:msg xmlns:ex='http://healthnet.com/soa/frmwk/exception'>
> The server has not found anything matching the Request-URI.
> </ex:msg>
> </detail>
> </soap:Fault>
> </soap:Body>
> </soap:Envelope>
>
>
> Thanks,
>
> Jay
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com