如何阻止用户在SOAPUI请求中添加额外标记

时间:2017-01-23 12:49:35

标签: web-services wsdl

以下是我的SOAP请求:                                              阿迪亚              ?                        

My rest of the classes are:
HelloWorld.java
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

//Service Endpoint Interface
@WebService
@SOAPBinding(style = Style.RPC)
public interface HelloWorld{

    @WebMethod String getHelloWorldAsString(String name, String company);

}

HelloWorldImpl.java:

import javax.jws.WebService;

import com.sun.xml.internal.ws.developer.SchemaValidation;

//Service Implementation
//@SchemaValidation
@WebService(endpointInterface = "org.techsavvy.HelloWorld")
public class HelloWorldImpl implements HelloWorld{

    @Override
    public String getHelloWorldAsString(String name, String company) {

        return "Hello!! your name is " + name+ " and you work in " +company+ ".";


    }

}


HelloWorldPublisher.java

import javax.xml.ws.Endpoint;
import org.techsavvy.HelloWorldImpl;

//Endpoint publisher
public class HelloWorldPublisher{

    public static void main(String[] args) {
       Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());

    }

}

问题:我通过添加wsdl路径(http://localhost:9999/ws/hello?wsdl)在SOAPUI中运行我的Web服务。生成请求后,我输入的值为和,并且运行成功。 我希望如果我在生成的请求中添加任何额外标记,则不应生成响应,系统应该抛出错误。

注意:我没有使用任何框架。

0 个答案:

没有答案