1

xslを使用してWebサービスのユーザー資格情報(ユーザー名トークンとパスワード)を変更するために、Webサービス呼び出しをインターセプトしようとしています。

SO呼び出しは、クライアント->インターセプター(ユーザー資格情報の変更)+その他の変更->元のOracle ERP /SiebelWebサービスの呼び出しに似ています。

これはxslを介して実行されます...さまざまなオプションを試しましたが、機能しませんでした...これについてはひどく助けが必要です...多くのサイトを検索しましたが、正しい答えが見つかりません。

Webサービスリクエストのサンプルを以下に示します。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" >
    <soapenv:Header>
        <UsernameToken xmlns="http://siebel.com/webservices">Bill</UsernameToken>
    <PasswordText xmlns="http://siebel.com/webservices">Gates</PasswordText>            
         <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
    </soapenv:Header>
<soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
</soapenv:Body>
</soapenv:Envelope>

これは、次の出力を提供するためにxslを使用して変換する必要があります。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" >
<soapenv:Header>
            <UsernameToken xmlns="http://siebel.com/webservices">Steve</UsernameToken>
            <PasswordText xmlns="http://siebel.com/webservices">Balmer</PasswordText>           
             <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
</soapenv:Header>
<soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
</soapenv:Body>
</soapenv:Envelope>
4

1 に答える 1

0

この変換:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:x="http://siebel.com/webservices">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="x:UsernameToken/text()">Steve</xsl:template>
 <xsl:template match="x:PasswordText/text()">Ballmer</xsl:template>
</xsl:stylesheet>

提供された XML ドキュメントに適用した場合:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cus="http://siebel.com/CustomUI" >
    <soapenv:Header>
        <UsernameToken
        xmlns="http://siebel.com/webservices">Bill</UsernameToken>
        <PasswordText
        xmlns="http://siebel.com/webservices">Gates</PasswordText>
        <SessionType
        xmlns="http://siebel.com/webservices">None</SessionType>
    </soapenv:Header>
    <soapenv:Body>
        <cus:SiebelService>
            <a>testvalue1</a>
            <b>testvalue2</b>
        </cus:SiebelService>
    </soapenv:Body>
</soapenv:Envelope>

必要な結果を生成します:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:cus="http://siebel.com/CustomUI">
   <soapenv:Header>
      <UsernameToken xmlns="http://siebel.com/webservices">Steve</UsernameToken>
      <PasswordText xmlns="http://siebel.com/webservices">Ballmer</PasswordText>
      <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
   </soapenv:Header>
   <soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
   </soapenv:Body>
</soapenv:Envelope>

説明: 要素がデフォルトの名前空間にある名前の選択は FAQ です。「デフォルト名前空間」の xpath および xslt タグを検索します。

于 2011-05-08T21:13:08.887 に答える