users@glassfish.java.net

Re: Web Service giving HTTP Status 403

From: Mark Hansen <marklists_at_javector.com>
Date: Fri, 12 May 2006 01:49:11 -0400

replying to myself here ...

Found a bug in the XML being posted. Not well formed. But, shouldn't
that cause a SOAP fault to come back, rather than a 403 HTTP status??


marklists_at_javector.com wrote:

>I'm doing a simple HTTP POST to a Provider<Source> and getting this HTML
>response from GlassFish:
>
><html>
><snip/>
>HTTP Status 403 - Access to the requested resource has been denied
><snip/>
>Access to the specified resource (Access to the requested resource has been
>denied) has been forbidden.
><snip/>
></html>
>
>After deploying the Provider<Source> I'm watching it on the Server Admin
>Console, and I don't see any Messages (under the Monitor tab for the deployed
>web service). So, I'm thinking that this is getting rejected by the servlet
>container before it even gets passed to my Provider<Source>.
>
>Here is the provider:
>
>@WebServiceProvider(
>serviceName = "SoajService",
>portName = "SoajPort",
>targetNamespace = "http://javector.com/soaj",
>wsdlLocation = "WEB-INF/wsdl/SoaWebService.wsdl")
>@ServiceMode(value=Service.Mode.PAYLOAD)
>public class SoajProvider implements Provider<Source> { ... }
>
>Here is the web.xml:
>
><?xml version="1.0" encoding="UTF-8"?>
><web-app xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> <servlet>
> <servlet-name>com.javector.soaj.provider.SoajProvider</servlet-name>
> <servlet-class>com.javector.soaj.provider.SoajProvider</servlet-class>
> <load-on-startup>0</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>com.javector.soaj.provider.SoajProvider</servlet-name>
> <url-pattern>/test</url-pattern>
> </servlet-mapping>
> <session-config>
> <session-timeout>60</session-timeout>
> </session-config>
></web-app>
>
>And the sun-web.xml:
>
><?xml version="1.0" encoding="UTF-8"?>
><sun-web-app>
> <context-root>provider-nowsdl</context-root>
></sun-web-app>
>
>Here is the client code that does the HTTP POST:
>
> HttpClient client = new HttpClient();
> PostMethod method = new
>PostMethod("http://localhost:8080/provider-nowsdl/test");
> method.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
> method.addRequestHeader(new Header("SOAPAction", "")); // needed ??
> method.setRequestEntity(new StringRequestEntity(
> "<env:Envelope
>xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"/>" +
> "<env:Header/>" +
> "<env:Body>" +
> " <ns:OperationName xmlns:ns=\"http://javector.com\">" +
> " <billToType xmlns=\"http://javector.com/ser/adaptive/po\">" +
> " <street>125 Main Street</street>" +
> " <city>Canton</city>" +
> " <state>OH</state>" +
> " <zip>98134</zip>" +
> " <phone>(973) 243-8776</phone>" +
> " </billToType>" +
> " </ns:OperationName>" +
> "</env:Body>" +
> "</env:Envelope>"
> ));
> client.executeMethod(method);
> System.out.println("SOAP response = " + IOUtil.NL +
> method.getResponseBodyAsString());
>
>
>Any ideas about what is wrong? Are there some HTTP security headers needed that
>I don't know about and that JAX-WS proxies automatically generate? How can I
>debug this? server.log give me nothing.
>
>Thanks for any help,
>
>Mark
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>