2012-04-11 8 views
4

シナリオ:SOAP :: Liteでネームスペースの生成をマングルするにはどうすればよいですか?

  • クライアントがSOAP::Liteを使ってPerlスクリプトです。
  • サーバーは、SpringとCXFを使用するJavaベースのアプリケーションです。

    <?xml version="1.0" encoding="UTF-8"?> 
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
        <soap:Body> 
         <createFolder xmlns="http://xyz.com/"> 
          <parentId xsi:type="xsd:string">1</parentId> 
          <folderName xsi:type="xsd:string">Test</folderName> 
         </createFolder> 
        </soap:Body> 
    </soap:Envelope> 
    

    この要求はCXFに対して失敗します:

私のクライアントは、WSDL、次のSOAP要求に基づいて生成されます。

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xyz="http://xyz.com/"> 
    <soap:Body> 
     <xyz:createFolder> 
      <parentId xsi:type="xsd:string">1</parentId> 
      <folderName xsi:type="xsd:string">Test</folderName> 
     </xyz:createFolder> 
    </soap:Body> 
</soap:Envelope> 

差が要素createFolderの名前空間の定義です:いくつかの調査の後、私は、次の手動作成した依頼が動作することが分かりました。

私の質問はSOAPリクエストを作成するためにSOAPLiteを設定するにはどうすればよいですか?

またはその逆:SOAP :: Lite要求スタイルを受け入れるようにCXFを設定するにはどうすればよいですか?

+0

CXFの構成上の問題でもあります。 – Philipp

答えて

3

nsをご覧ください。

SOAP::Lite->new->proxy('http://somewhere.com') 
    ->ns('http://xyz.com/', 'xyz')->createFolder( 
     SOAP::Data->new(name => 'parentId', value => 1, type => 'xsd:string') 
    , SOAP::Data->new(name => 'folderName', value => 'Test') 
    ); 

は、私は次のようだ:使用フラグメントのルート要素についても同様に修飾名

を与える場合は、次の

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:xyz="http://xyz.com/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
> 
    <soap:Body> 
    <xyz:createFolder> 
     <parentId xsi:type="xsd:string">1</parentId> 
     <folderName xsi:type="xsd:string">Test</folderName> 
    </xyz:createFolder> 
    </soap:Body> 
</soap:Envelope> 

そして、私はそれはあなたが欲しいものだと思います。

関連する問題