0

我试图让soapUI 识别我的ServiceStack 肥皂服务中的类型。我确定我在设置服务时做错了什么。这是 WSDL:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="Soap12" 
    targetNamespace="https://something.com/service/types" 
    xmlns:svc="https://something.com/service/types" 
    xmlns:tns="https://something.com/service/types" 

    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
    xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
    xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
    xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">

    <wsdl:types>
        <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="anyType" nillable="true" type="xs:anyType" />
  <xs:element name="anyURI" nillable="true" type="xs:anyURI" />
  <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
  <xs:element name="boolean" nillable="true" type="xs:boolean" />
  <xs:element name="byte" nillable="true" type="xs:byte" />
  <xs:element name="dateTime" nillable="true" type="xs:dateTime" />
  <xs:element name="decimal" nillable="true" type="xs:decimal" />
  <xs:element name="double" nillable="true" type="xs:double" />
  <xs:element name="float" nillable="true" type="xs:float" />
  <xs:element name="int" nillable="true" type="xs:int" />
  <xs:element name="long" nillable="true" type="xs:long" />
  <xs:element name="QName" nillable="true" type="xs:QName" />
  <xs:element name="short" nillable="true" type="xs:short" />
  <xs:element name="string" nillable="true" type="xs:string" />
  <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
  <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
  <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
  <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
  <xs:element name="char" nillable="true" type="tns:char" />
  <xs:simpleType name="char">
    <xs:restriction base="xs:int" />
  </xs:simpleType>
  <xs:element name="duration" nillable="true" type="tns:duration" />
  <xs:simpleType name="duration">
    <xs:restriction base="xs:duration">
      <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
      <xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
      <xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="guid" nillable="true" type="tns:guid" />
  <xs:simpleType name="guid">
    <xs:restriction base="xs:string">
      <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:attribute name="FactoryType" type="xs:QName" />
  <xs:attribute name="Id" type="xs:ID" />
  <xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
    </wsdl:types>

    <wsdl:message name="IsAvailableRequestIn">
        <wsdl:part name="parameters" element="tns:IsAvailableRequest" />
    </wsdl:message>
    <wsdl:message name="IsAvailableRequestOut">
        <wsdl:part name="parameters" element="tns:IsAvailableRequestResponse" />
    </wsdl:message>



    <wsdl:portType name="ISyncReply">
    <wsdl:operation name="IsAvailableRequest">
        <wsdl:input message="svc:IsAvailableRequestIn" />
        <wsdl:output message="svc:IsAvailableRequestOut" />
    </wsdl:operation>
    </wsdl:portType>

    <wsdl:portType name="IOneWay">

    </wsdl:portType>

    <wsdl:binding name="WSHttpBinding_ISyncReply" type="svc:ISyncReply">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="IsAvailableRequest">
      <soap:operation soapAction="https://something.com/service/types/IsAvailableRequest" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>

    <wsdl:binding name="WSHttpBinding_IOneWay" type="svc:IOneWay">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

    </wsdl:binding>

    <wsdl:service name="SyncReply">
        <wsdl:port name="WSHttpBinding_ISyncReply" binding="svc:WSHttpBinding_ISyncReply">
            <soap:address location="http://beta.something.com/service/soap12" />
        </wsdl:port>
    </wsdl:service>

    <wsdl:service name="AsyncOneWay">
        <wsdl:port name="WSHttpBinding_IOneWay" binding="svc:WSHttpBinding_IOneWay">
            <soap:address location="http://beta.something.com/service/soap12" />
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

请注意,它不包含类型信息(我不知道,应该是吗?)这是类型模式:

<?xml version="1.0"?>
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/SomethingWeb" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/SomethingWeb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="IsAvailableRequest">
    <xs:sequence>
      <xs:element minOccurs="0" name="ClientID" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" name="Token" nillable="true" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="IsAvailableRequest" nillable="true" type="tns:IsAvailableRequest" />
  <xs:complexType name="IsAvailableResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="Available" nillable="true" type="tns:ArrayOfAvailableData" />
      <xs:element minOccurs="0" name="ClientID" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" name="Location" nillable="true" type="tns:Location" />
      <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" name="Request" nillable="true" type="tns:IsAvailableRequest" />
      <xs:element minOccurs="0" name="ReturnCode" type="xs:int" />
      <xs:element minOccurs="0" name="Token" nillable="true" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="IsAvailableResponse" nillable="true" type="tns:IsAvailableResponse" />
  <xs:complexType name="ArrayOfAvailableData">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="AvailableData" nillable="true" type="tns:AvailableData" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ArrayOfAvailableData" nillable="true" type="tns:ArrayOfAvailableData" />
  <xs:complexType name="AvailableData">
    <xs:sequence>
      <xs:element minOccurs="0" name="Code" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" name="Label" nillable="true" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="AvailableData" nillable="true" type="tns:AvailableData" />
  <xs:complexType name="Location">
    <xs:sequence>
      <xs:element minOccurs="0" name="Result" nillable="true" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Location" nillable="true" type="tns:Location" />
</xs:schema>

如何让soapUI(以及其他java代码)来理解我的架构?

4

1 回答 1

1

我刚刚遇到了这个问题,并通过在 AppHost 中添加默认命名空间来解决它

SetConfig(new EndpointHostConfig {
    WsdlServiceNamespace = "http://my.new.namespace.com/types",
});

并用

[DataContract(Namespace = "http://my.new.namespace.com/types")]

更多详细信息:https ://github.com/ServiceStack/ServiceStack/wiki/SOAP-support

于 2013-08-30T04:48:18.513 回答