cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Hvid <christian.h...@gmail.com>
Subject Java-first SOAP via HTTP GET and enums
Date Mon, 13 Sep 2010 12:43:31 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message