2011-08-02 9 views
2

私は私のサーブレットで春の構成を有していて...春のWS&複数のスキーマ

<context:component-scan base-package="org.knowledgebase.webservice"/> 
<sws:annotation-driven/> 

<sws:dynamic-wsdl id="carService" 
        portTypeName="carService" 
        locationUri="/carService/"> 
    <sws:xsd location="classpath:/wsDefinition/car/properties.xsd"/> 
    <sws:xsd location="classpath:/wsDefinition/car/carServiceSimple.xsd"/> 
</sws:dynamic-wsdl> 

<bean class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"> 
    <property name="soapVersion"> 
     <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_11"/> 
    </property> 
</bean> 

と同じフォルダ内の2つのXSD - carServiceSimple.xsd:

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     xmlns:pro="http://bar.foo/properties" 
     targetNamespace="http://bar.foo" 
     elementFormDefault="qualified"> 

<xs:import schemaLocation="properties.xsd" namespace="http://bar.foo/properties"/> 

<xs:element name="StoreCarRequest"> 
    <xs:complexType> 
     <xs:sequence> 
      <xs:element name="ID" type="xs:string"/> 
      <xs:element name="Name" type="xs:string"/> 
      <xs:element name="Properties" type="pro:PropertiesType"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:element> 
<xs:complexType name="StoreCarResponse"> 
    <xs:sequence> 
     <xs:element name="Status" type="xs:string"/> 
    </xs:sequence> 
</xs:complexType> 

<xs:element name="UpdateCarRequest"> 
    <xs:complexType> 
     <xs:sequence> 
      <xs:element name="ID" type="xs:string"/> 
      <xs:element name="Properties" type="pro:PropertiesType"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:element> 
<xs:complexType name="UpdateCarResponse"> 
    <xs:sequence> 
     <xs:element name="Status" type="xs:string"/> 
    </xs:sequence> 
</xs:complexType> 
</xs:schema> 
  • properties.xsd :

しかし、Glassfishの3の上に展開した後、例外が発生している:複数の要素がコモンズXMLSchema.PleaseがクラスパスにCommonsのXMLスキーマを置く必要です。

Spring wsドキュメントセクション5.3.1: 複数のスキーマをインクルードまたはインポートのいずれかで使用する場合は、Commons XMLSchemaをクラスパスに配置します。 Commons XMLSchemaがクラスパス上にある場合、上記の要素はすべてのXSDインポートに続き、それらを単一のXSDとしてWSDL内に組み込みます。

"Commons XMLSchema"とは何ですか?どうすれば修正できますか?どうも。

私はクラスパス(戦争では:WEB-INF \ classes \ wsDefinition \ car)に両方のXSDファイルを持っています。サーブレットから行を削除すると、wsdlにアクセスできるようになりますが、このwsdlでSoapUIプロジェクトのベースを作成したい場合、SopaUIはエラーを表示します:not found find.xsd。

答えて

3

WEB-INF/libディレクトリにCommons XMLSchemaプロジェクトのjarファイルを含める必要があります。

+0

それはライブラリですUPPS、あなたがbeny23感謝。それは私の最も愚かな質問でした。おそらく、このエラーが発生したのは遅すぎたのです。 – Ziletka

3

誰かがここに着地した場合...あなたのpom.xmlにこの依存関係を追加

<dependency> 
    <groupId>org.apache.ws.xmlschema</groupId> 
    <artifactId>xmlschema-core</artifactId> 
    <version>2.0.1</version> 
</dependency> 
関連する問題