Java CXF生成的客户端不';不包括SOAP头
使用Apache CXF发行版中部署的示例wsdl 我在pom.xml中配置了一个小型Maven项目,其中包含以下(cxf codegen插件)代码生成设置:Java CXF生成的客户端不';不包括SOAP头,java,maven,soap,cxf,wsdl2java,Java,Maven,Soap,Cxf,Wsdl2java,使用Apache CXF发行版中部署的示例wsdl 我在pom.xml中配置了一个小型Maven项目,其中包含以下(cxf codegen插件)代码生成设置: ... <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <
...
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.3.6</version>
<executions>
<execution>
<id>generate-sources-x</id>
<phase>generate-sources</phase>
<configuration>
<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
<includes>
<include>hello_world.wsdl</include>
</includes>
<defaultOptions>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-p</extraarg>
<extraarg>my.test.package</extraarg>
<extraarg>-exsh</extraarg>
<extraarg>true</extraarg>
</extraargs>
</defaultOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...
。。。
org.apache.cxf
)
我的实现有什么问题
public class Test3 {
public static void main(String[] args) throws JAXBException {
System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
String url = "http://www.mmm.xxx/yyy/zzz";
SOAPService service = new SOAPService();
Greeter client = service.getSoapPort();
BindingProvider bp = (BindingProvider) client;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
List<Header> headers = new ArrayList<Header>();
Header dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"), "decapitated", new JAXBDataBinding(String.class));
headers.add(dummyHeader);
bp.getRequestContext().put(Header.HEADER_LIST, headers);
String response = client.greetMe("CIAO!");
}
}
---[HTTP request - http://www.mmm.xxx/yyy/zzz]---
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
User-Agent: JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><greetMe xmlns="http://apache.org/hello_world_soap_http/types"><requestType>CIAO!</requestType></greetMe></S:Body></S:Envelope>--------------------