1

我已经建立了一个基本的 Web 服务(代码如下)。然后我生成了 WSDL 文件(右键单击-> 生成 WSDL)不幸的是 SoapAction 是空的。有什么建议吗?我添加了@WebService(name = "testService", targetNamespace = "test.test/webService")因为只有@WebService我认为这会有所帮助 - 我想我错了......非常烦人的错误(或人类的愚蠢^^)

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 文件不包含肥皂动作。

4

1 回答 1

0

尝试:

@WebMethod(action = "hello")
于 2013-04-16T13:48:55.140 回答