cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Hvid <christian.h...@gmail.com>
Subject Re: Java-first SOAP via HTTP GET and enums
Date Tue, 14 Sep 2010 21:07:17 GMT
As far as I know it has been a part of SOAP for ages and it works in .NET and the old Apache
Axis.

It is an extremely useful feature for testing and documentation.

Thanks for the hint - I will try and see if I can patch up things tomorrow.

On Sep 14, 2010, at 9:56 PM, Daniel Kulp wrote:

> 
> 
> On Monday 13 September 2010 5:42:04 pm Christian Hvid wrote:
>> Yes. You can find SOAP over HTTP GET described here:
>> 
>> http://www.w3.org/TR/soap12-part0/#L26854
>> 
>> And other places.
> 
> According to that link:
> "Using the HTTP binding with the SOAP Response message exchange pattern is 
> restricted to the HTTP GET method"
> 
> which is a pattern that is completely outside the JAX-WS spec and is pretty 
> much unsupported by everyone.  
> 
> 
>> 
>> If you change the test4 method below to say:
>> 
>> public void test4(@WebParam(name = "myString") String myString)
>> 
>> Then:
>> 
>> http://localhost:9000/TestDims/test4?myString=A
>> 
>> Will work as expected.
> 
> Well, this is kind of a special case in that CXF does provide an interceptor 
> that allows a small subset of the normal SOAP/HTTP POST  Request/Response 
> patterns to be accessible via a GET URL.   This would be specific to CXF 
> though and there are a LOT of limitations.  Like no structures and such.   I'm 
> only slightly surprised that the enum isn't working.  
> 
> If you'd like to dig in and fix it, the place to start would be the 
> URIMappingInterceptor in the readType method.   As you can see, it maps all 
> the "primitive"/"built in" type things.  It probably could be easily updated 
> to do a if (type.isEnum()) ...  type thing to handle enums.   A patch would be 
> more than welcome.
> 
> 
> Dan
> 
> 
> 
>> 
>> On Sep 13, 2010, at 4:41 PM, Christian Schneider wrote:
>>> Are you sure this is expected to work? Normally SOAP / HTTP always uses
>>> Post not get. You could have more luck using the HTTP binding or REST
>>> instead of SOAP.
>>> 
>>> Regards
>>> 
>>> Christian
>>> 
>>> Am 13.09.2010 14:43, schrieb Christian Hvid:
>>>> Hello again list.
>>>> 
>>>> I am also having some trouble sending an enum in HTTP GET via a
>>>> Java-first SOAP implementation.
>>>> 
>>>> import java.util.Date;
>>>> 
>>>> @WebService()
>>>> public interface MyInterface {
>>>> 
>>>>    public MyEnum test3();
>>>> 
>>>>    public void test4(@WebParam(name = "myEnum") MyEnum myEnum);
>>>> 
>>>> }
>>>> 
>>>> public class MyImplementation implements MyInterface {
>>>> 
>>>>    public MyEnum test3() {
>>>> 
>>>>        return MyEnum.A;
>>>> 
>>>>    }
>>>> 
>>>>    public void test4(@WebParam(name = "myEnum") MyEnum myEnum) {
>>>> 
>>>>        System.out.println(""+myEnum);
>>>> 
>>>>    }
>>>> 
>>>> }
>>>> 
>>>> public enum MyEnum {
>>>> 
>>>>    A, B, C
>>>> 
>>>> }
>>>> 
>>>> public class StartTestDims {
>>>> 
>>>>    public static void main(String[] args) {
>>>> 
>>>>        MyImplementation implementor = new MyImplementation();
>>>>        JaxWsServerFactoryBean svrFactory = new
>>>>        JaxWsServerFactoryBean();
>>>>        svrFactory.setServiceClass(MyInterface.class);
>>>>        svrFactory.setAddress("http://localhost:9000/TestDims");
>>>>        svrFactory.setServiceBean(implementor);
>>>>        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
>>>>        svrFactory.getOutInterceptors().add(new
>>>>        LoggingOutInterceptor()); svrFactory.create();
>>>> 
>>>>    }
>>>> 
>>>> }
>>>> 
>>>> When I go:
>>>> 
>>>> http://localhost:9000/TestDims/test3
>>>> 
>>>> I get:
>>>> 
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>> <soap:Body>
>>>> <ns2:test3Response xmlns:ns2="http://unknown.namespace/">
>>>> 
>>>>  <return>A</return>
>>>> 
>>>> </ns2:test3Response>
>>>> </soap:Body>
>>>> </soap:Envelope>
>>>> 
>>>> But when I go:
>>>> 
>>>> http://localhost:9000/TestDims/test4?myEnum=A
>>>> 
>>>> I get:
>>>> 
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>> <soap:Body>
>>>> <soap:Fault>
>>>> 
>>>>  <faultcode>soap:Server</faultcode>
>>>>  <faultstring>argument type mismatch while invoking public abstract
>>>>  void
>>>> 
>>>> MyInterface.test4(MyEnum) with params [A].</faultstring>
>>>> </soap:Fault>
>>>> </soap:Body>
>>>> </soap:Envelope>
>>>> 
>>>> What I am doing wrong?
>>>> 
>>>> What is the correct format?
>>>> 
>>>> In the WSDL myEnum shows up as:
>>>> 
>>>> <xs:simpleType name="myEnum">
>>>> <xs:restriction base="xs:string">
>>>> 
>>>>  <xs:enumeration value="A" />
>>>>  <xs:enumeration value="B" />
>>>>  <xs:enumeration value="C" />
>>>> 
>>>> </xs:restriction>
>>>> </xs:simpleType>
>>>> 
>>>> That is - an xs:string with a restriction.
>>>> 
>>>> (The end-implementation will use SOAP over HTTP POST - I need HTTP GET
>>>> for documentation and cross-platform testing.)
>>>> 
>>>> -- Christian
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog


Mime
View raw message