Jakarta ee 响应验证中的奇怪SOAP行为

Jakarta ee 响应验证中的奇怪SOAP行为,jakarta-ee,soap,jaxb,webserver,jax-ws,Jakarta Ee,Soap,Jaxb,Webserver,Jax Ws,我正试图通过使用xs:choice实现一个SOAP服务,但是我的日子不好过 首先,我编写了一个xml模式,然后使用xcj生成了我的类,但是服务没有验证我的响应,尽管我认为响应是正确的 好的,首先是WSDL: <?xml version='1.0' encoding='UTF-8'?> <definitions targetNamespace="http://ofelia/" name="agrupaServiceWS" xmlns="http://schemas.xmlsoa

我正试图通过使用xs:choice实现一个SOAP服务,但是我的日子不好过

首先,我编写了一个xml模式,然后使用xcj生成了我的类,但是服务没有验证我的响应,尽管我认为响应是正确的

好的,首先是WSDL:

 <?xml version='1.0' encoding='UTF-8'?>
<definitions targetNamespace="http://ofelia/" name="agrupaServiceWS" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ofelia/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://ofelia/" schemaLocation="agrupaServiceWS_schema1.xsd"/>
    </xsd:schema>
  </types>
  <message name="diz">
    <part name="parameters" element="tns:diz"/>
  </message>
  <message name="dizResponse">
    <part name="parameters" element="tns:dizResponse"/>
  </message>
  <message name="dizPosi">
    <part name="parameters" element="tns:dizPosi"/>
  </message>
  <message name="dizPosiResponse">
    <part name="parameters" element="tns:dizPosiResponse"/>
  </message>
  <portType name="agrupa">
    <operation name="diz">
      <input message="tns:diz"/>
      <output message="tns:dizResponse"/>
    </operation>
    <operation name="dizPosi">
      <input message="tns:dizPosi"/>
      <output message="tns:dizPosiResponse"/>
    </operation>
  </portType>
  <binding name="agrupaPortBinding" type="tns:agrupa">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="diz">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
    <operation name="dizPosi">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="agrupaServiceWS">
    <port name="agrupaPort" binding="tns:agrupaPortBinding">
      <soap:address location="http://localhost:7101/ofelia/agrupaServiceWS"/>
    </port>
  </service>
</definitions>
当我请求diz方法时,响应为“SOAP消息中存在错误”,但http内容看起来是正确的:

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:dizResponse xmlns:ns2="http://ofelia/">
            <ns2:return>
                <ns2:POSI>
                    <TimeStamp>qweqwe</TimeStamp>
                    <RefreshInterval>3</RefreshInterval>
                    <Lon>53</Lon>
                    <Lat>14</Lat>
                </ns2:POSI>
            </ns2:return>
        </ns2:dizResponse>
    </S:Body>
</S:Envelope>

qweqwe
3.
53
14
有人能试着找出问题所在吗


向您致意

那么您使用JDeveloper测试Web服务功能了吗?如果是这样的话,我过去也遇到过一些问题。用Java为WS生成一个客户机,并以这种方式进行测试


编辑:对不起,我想在评论中写下这句话。

你能发布完整的错误消息吗?我使用的是jdeveloper,错误消息是:SOAP消息中有错误,这意味着它的结构无法显示。但是,如果我检查应答器内容,我会找到我一直显示的预期xml
package ofelia;

import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;


@WebService(wsdlLocation = "WEB-INF/wsdl/agrupaServiceWS.wsdl", serviceName = "agrupaServiceWS", targetNamespace = "http://ofelia/")
public class agrupa {

    public agrupa() {

    }

@WebMethod
    @WebResult(targetNamespace = "http://ofelia/")
    public Data diz() {
        ObjectFactory fac = new ObjectFactory();
        OfeliaDataEx of = fac.createOfeliaDataEx();
        Header temp = new Header(); //fac.createHeader();
        temp.setState("ASW");
        temp.setTypeReq("REQ");
        //of.setHeader(value); setHeader(fac.createHeader());
        POSI x = new POSI();
        x.setLat(2);
        x.setLon(5);
        x.setRefreshInterval(1);
        x.setTimeStamp("asdasdsa");
        POSI y = new POSI();
        y.setLat(14);
        y.setLon(53);
        y.setRefreshInterval(3);
        y.setTimeStamp("qweqwe");
        TESTE teste = new TESTE();
        teste.setCenas(1.F);
        teste.setTimeStamp("asdasdasd");
        Data elem = new Data();  
        elem.getContent().add(y);
        //elem.getContent().add(teste);
        //elem.getContent().add(x);
        return elem;
    }

    public POSI dizPosi() {
        ObjectFactory fac = new ObjectFactory();
        OfeliaDataEx of = fac.createOfeliaDataEx();
        Header temp = new Header(); //fac.createHeader();
        temp.setState("ASW");
        temp.setTypeReq("REQ");
        //of.setHeader(value); setHeader(fac.createHeader());
        POSI x = new POSI();
        x.setLat(2);
        x.setLon(5);
        x.setRefreshInterval(1);
        x.setTimeStamp("asdasdsa");
        POSI y = new POSI();
        y.setLat(1);
        y.setLon(5);
        y.setRefreshInterval(3);
        y.setTimeStamp("qweqwe");
        TESTE teste = new TESTE();
        teste.setCenas(1.F);
        teste.setTimeStamp("asdasdasd");
        Data elem = new Data();  
        elem.getContent().add(y);
        elem.getContent().add(teste);
        //elem.getContent().add(x);
        return x;
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:dizResponse xmlns:ns2="http://ofelia/">
            <ns2:return>
                <ns2:POSI>
                    <TimeStamp>qweqwe</TimeStamp>
                    <RefreshInterval>3</RefreshInterval>
                    <Lon>53</Lon>
                    <Lat>14</Lat>
                </ns2:POSI>
            </ns2:return>
        </ns2:dizResponse>
    </S:Body>
</S:Envelope>