我已经设置了一个基本的Web服务(代码如下)。然后我生成了WSDL文件(右键单击->生成WSDL)很遗憾,SoapAction为空。有什么建议吗?我添加了@WebService(name="testService",targetNamespace="test.test/WebService"),因为只有@WebService。我认为这会有所帮助-我想我错了。。。相当烦人的bug(或人类的愚蠢^^)
Tst289374.java:
package com.test;
import javax.jws.*;
import javax.jws.soap.SOAPBinding;
@WebService(name = "testService", targetNamespace = "test.test/webService")
public class Tst289374 {
@WebMethod
public void hello() {
}
}
WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.6hudson-86 svn-revision#12773. -->
<definitions targetNamespace="http://test.com/" name="Tst289374Service" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://test.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema>
<xsd:import namespace="http://test.com/" schemaLocation="Tst289374Service_schema1.xsd"/>
</xsd:schema>
</types>
<message name="hello">
<part name="parameters" element="tns:hello"/>
</message>
<message name="helloResponse">
<part name="parameters" element="tns:helloResponse"/>
</message>
<portType name="Tst289374">
<operation name="hello">
<input wsam:Action="http://test.com/Tst289374/helloRequest" message="tns:hello"/>
<output wsam:Action="http://test.com/Tst289374/helloResponse" message="tns:helloResponse"/>
</operation>
</portType>
<binding name="Tst289374PortBinding" type="tns:Tst289374">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="hello">
**<soap:operation soapAction=""/>**
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="Tst289374Service">
<port name="Tst289374Port" binding="tns:Tst289374PortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
编辑:同样,未右键单击生成的wsdl文件不包含soap操作。
尝试:
@WebMethod(action = "hello")