Почему ProcessExecutionEngine всегда отправляет нулевые входные параметры в веб-службу?

Я пытаюсь запустить веб-службу на основе ее owls файла описания, используя owls-api -3.1.

Веб-служба представляет собой простой jax-ws, развернутый с помощью grizzly, файл owls сгенерированный с использованием класса WSDL2OWLS из примеров кода (загруженных и извлеченных из jar-файла src), код размещен в этой версии репозиторий github.

(веб-сервис хорошо протестирован с использованием soapUI)

Определение веб-службы

@WebService(serviceName = "Hello", targetNamespace = HelloService.WSDL_FILE)
public class HelloService {

    public static final String ROUTE = "/hello";
    public static final String OWLS_FILE = Bootstrap.OWLS_DIR + "/hello.owl";
    public static final String WSDL_FILE = "HTTP://127.0.0.1/hello?wsdl";

    /**
     * This is a sample web service operation
     *
     * @param name
     * @return
     */
    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "name") String name) {
        return "Hello " + name;
    }
}

Развертывание веб-сервиса

HttpServer httpServer = new HttpServer();
NetworkListener networkListener = new NetworkListener("grizzly", "0.0.0.0", 8080);
httpServer.addListener(networkListener);
httpServer.getServerConfiguration().addHttpHandler(new CLStaticHttpHandler(Bootstrap.class.getClassLoader(), "static/"), "/");
httpServer.getServerConfiguration().addHttpHandler(new JaxwsHandler(new HelloService()), HelloService.ROUTE);

httpServer.start();
Thread.sleep(2 * 1000); // The services are up and running    
System.out.println(" --- OWLS client --- ");
new HelloServiceOWLSClient().start();    
Thread.currentThread().join();

клиент OWLS

public class HelloServiceOWLSClient {

    private static final Logger LOG = Logger.getLogger(HelloServiceOWLSClient.class.getName());

    public void start() {
        try {

            OWLKnowledgeBase kb = OWLFactory.createKB();
            Service service = kb.readService(URI.create(HelloService.OWLS_FILE));
            Process process = service.getProcess();         
            ProcessExecutionEngine executionEngine = OWLSFactory.createExecutionEngine();

            ValueMap<Input, OWLValue> inputs = new ValueMap<>();
            inputs.setValue(process.getInput("name"), kb.createDataValue("tarrsalah"));
            LOG.log(Level.INFO, inputs.debugString());

            ValueMap<Output, OWLValue> outputs = executionEngine.execute(process, inputs, kb);

            LOG.log(Level.INFO, outputs.debugString());

        } catch (IOException | ExecutionException ex) {
            LOG.log(Level.SEVERE, ex.toString());
        } finally {

        }
    }
}

Полная трассировка стека

May 25, 2014 1:34:33 AM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [0.0.0.0:8080]
May 25, 2014 1:34:34 AM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
 --- OWLS client --- 
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/Service.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/Profile.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/ActorDefault.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/ServiceParameter.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/ServiceCategory.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/Process.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/generic/ObjectList.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/generic/Expression.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://www.daml.org/services/owl-s/1.2/Grounding.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://on.cs.unibas.ch/owl-s/1.2/MoreGroundings.owl# ...
 INFO [org.tarrsalah.owls.examples.Bootstrap.main()] (Vocabulary.java:118) - Loading ontology http://on.cs.unibas.ch/owl-s/1.2/FLAService.owl# ...
May 25, 2014 1:34:38 AM org.tarrsalah.owls.examples.HelloServiceOWLSClient start
INFO: (name = tarrsalah)
May 25, 2014 1:34:39 AM org.tarrsalah.owls.examples.HelloServiceOWLSClient start
INFO: (return = Hello null)
-----

В последней строчке меня ожидали Hello tarrsalah вместо Hello null

Создан полный файл owls

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:grounding="http://www.daml.org/services/owl-s/1.2/Grounding.owl#"
    xmlns="http://www.example.org/service.owl"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:list="http://www.daml.org/services/owl-s/1.2/generic/ObjectList.owl#"
    xmlns:expr="http://www.daml.org/services/owl-s/1.2/generic/Expression.owl#"
    xmlns:swrl="http://www.w3.org/2003/11/swrl#"
    xmlns:service="http://www.daml.org/services/owl-s/1.2/Service.owl#"
    xmlns:profile="http://www.daml.org/services/owl-s/1.2/Profile.owl#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:process="http://www.daml.org/services/owl-s/1.2/Process.owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
  xml:base="http://www.example.org/service.owl">
  <owl:Ontology rdf:about="">
    <owl:imports rdf:resource="http://www.daml.org/services/owl-s/1.2/Grounding.owl"/>
    <owl:imports rdf:resource="http://www.daml.org/services/owl-s/1.2/Profile.owl"/>
  </owl:Ontology>
  <service:Service rdf:ID="helloService">
    <service:supports>
      <grounding:WsdlGrounding rdf:ID="helloGrounding"/>
    </service:supports>
    <service:describedBy>
      <process:AtomicProcess rdf:ID="helloProcess"/>
    </service:describedBy>
    <service:presents>
      <profile:Profile rdf:ID="helloProfile"/>
    </service:presents>
  </service:Service>
  <profile:Profile rdf:about="#helloProfile">
    <profile:hasOutput>
      <process:Output rdf:ID="return">
        <process:parameterType rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://www.w3.org/2001/XMLSchema#string</process:parameterType>
        <rdfs:label>return</rdfs:label>
      </process:Output>
    </profile:hasOutput>
    <profile:hasInput>
      <process:Input rdf:ID="name">
        <process:parameterType rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://www.w3.org/2001/XMLSchema#string</process:parameterType>
        <rdfs:label>name</rdfs:label>
      </process:Input>
    </profile:hasInput>
    <profile:textDescription>Auto generated from HTTP://127.0.0.1/hello?wsdl</profile:textDescription>
    <profile:serviceName>hello</profile:serviceName>
    <service:presentedBy rdf:resource="#helloService"/>
  </profile:Profile>
  <process:AtomicProcess rdf:about="#helloProcess">
    <process:hasOutput rdf:resource="#return"/>
    <process:hasInput rdf:resource="#name"/>
    <service:describes rdf:resource="#helloService"/>
    <rdfs:label>helloProcess</rdfs:label>
  </process:AtomicProcess>
  <grounding:WsdlGrounding rdf:about="#helloGrounding">
    <grounding:hasAtomicProcessGrounding>
      <grounding:WsdlAtomicProcessGrounding rdf:ID="helloAtomicProcessGrounding"/>
    </grounding:hasAtomicProcessGrounding>
    <service:supportedBy rdf:resource="#helloService"/>
  </grounding:WsdlGrounding>
  <grounding:WsdlAtomicProcessGrounding rdf:about="#helloAtomicProcessGrounding">
    <grounding:wsdlOutput>
      <grounding:WsdlOutputMessageMap>
        <grounding:wsdlMessagePart rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >HTTP://127.0.0.1/hello?wsdl#return</grounding:wsdlMessagePart>
        <grounding:owlsParameter rdf:resource="#return"/>
      </grounding:WsdlOutputMessageMap>
    </grounding:wsdlOutput>
    <grounding:wsdlInput>
      <grounding:WsdlInputMessageMap>
        <grounding:wsdlMessagePart rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >HTTP://127.0.0.1/hello?wsdl#name</grounding:wsdlMessagePart>
        <grounding:owlsParameter rdf:resource="#name"/>
      </grounding:WsdlInputMessageMap>
    </grounding:wsdlInput>
    <grounding:wsdlOutputMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
    >http://127.0.0.1/hello?wsdl#helloResponse</grounding:wsdlOutputMessage>
    <grounding:wsdlInputMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
    >http://127.0.0.1/hello?wsdl#hello</grounding:wsdlInputMessage>
    <grounding:wsdlDocument rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
    >HTTP://127.0.0.1/hello?wsdl</grounding:wsdlDocument>
    <grounding:wsdlOperation>
      <grounding:WsdlOperationRef>
        <grounding:operation rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >HTTP://127.0.0.1/hello?wsdl#hello</grounding:operation>
      </grounding:WsdlOperationRef>
    </grounding:wsdlOperation>
    <grounding:owlsProcess rdf:resource="#helloProcess"/>
  </grounding:WsdlAtomicProcessGrounding>
</rdf:RDF>

person Salah Eddine Taouririt    schedule 24.05.2014    source источник


Ответы (1)


Кажется, что ось 1.4 использовать rpc soap для вызова веб-службы. Установка SOAPBinding на Style.RPC в объявлении веб-службы решает проблему.

WebService(serviceName = "Hello", targetNamespace = "http://127.0.0.1/hello")
@SOAPBinding(style = Style.RPC)

public class HelloService {

    public static final String ROUTE = "/hello";
    public static final String OWLS_FILE = Bootstrap.OWLS_DIR + "/hello.owl";
    public static final String WSDL_FILE = "http://127.0.0.1/hello?wsdl";

    /**
     * This is a sample web service operation
     *
     * @param name
     * @return
     */
    @WebMethod(operationName = "hello")
    @WebResult(name="greeting")
    public String hello(@WebParam(name = "name") String name) {
        return "Hello " + name;
    }
}
person Salah Eddine Taouririt    schedule 25.05.2014