13 Replies Latest reply: Feb 26, 2009 1:21 PM by 477172 RSS

    How to set up Authentication for BAM WebServices

    Lucas Jellema
      Hi,

      With 11gTP4 I have tried to use the BAM WebServices for DataObjects updates. I think I have worked out the XML content of the SOAP message I have to send. However, how should I provide authentication details? Without credentials, my service calls ends with an HTTP 401 error. With WS-Security credentials added to the SOAP header , I still get the 401.


      Without WS-Security, my call looks like this:
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          <soap:Body xmlns:ns1="http://xmlns.oracle.com/bam">
              <ns1:Upsert>
                  <ns1:dataObject>/PayRaise/SalaryIncrease</ns1:dataObject>
                  <ns1:keysCSV>_empno</ns1:keysCSV>
                  <ns1:xmlPayload><SalaryIncrease>
                                     <_empno>100</_empno>
                                     <_awardedSalary>10000</_awardedSalary>
                                     <_name>Henk</_name>
      </SalaryIncrease></ns1:xmlPayload>
              </ns1:Upsert>
          </soap:Body>
      </soap:Envelope>
      Anyone can help?

      Thanks.

      Lucas
        • 1. Re: How to set up Authentication for BAM WebServices
          391356
          Lucas,

          1. BAM doesn't support WS-Security for authentication, it supports authentication through HTTP BASIC authentication mechanism. Try to pass your authentication details through HTTP header.

          2. If 1 doesn't work, test and debug the issue through IE - use this URL: http://host:port/OracleBAM/WebServices/DataObjectOperationsByID, once BASIC Authentication window pops up, enter the credentials and on the webservice page, choose "Update", enter your data and finally, expand "Show Transport Info" and enter your credentials again. This would work. Compare this with what you have been doing earlier :-)

          Thanks,
          Vishal
          • 2. Re: How to set up Authentication for BAM WebServices
            Lucas Jellema
            Hi Vishal,

            Thanks for your help.

            I tried invoking the BAM DataObject WebService from the test page and run into this error message:
            <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://xmlns.oracle.com/bam"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>Caught exception while handling request: trailing block elements must have an id attribute</faultstring></env:Fault></env:Body></env:Envelope>
            After sending this request - with HTTP Authentication added in the Transport Info -:
            <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                <soap:Body xmlns:ns1="http://xmlns.oracle.com/bam">
                    <ns1:Insert>
                       <ns1:dataObject>/HelloWorldDO</ns1:dataObject>
                       <ns1:xmlPayload>
                          <DOInstance>
                             <_instanceId>999</_instanceId>
                             <_inputParameter>SomeName</_inputParameter>
                          </DOInstance>
                       </ns1:xmlPayload>
                    </ns1:Insert>
                </soap:Body>
            </soap:Envelope>
            Does this error message tell you anything?

            The article http://soastation.blogspot.com/2007/11/trailing-block-elements-must-have-id.html suggests a mismatch between WSDL and XSD.

            thanks again and best regards,

            Lucas
            • 3. Re: How to set up Authentication for BAM WebServices
              Lucas Jellema
              Well perhaps it is the presence of the dataObject element that is not part of the WSDL - however is suggested in the documentation and seems required to instruct the BAM WebService which DataObject is involved here. The WSDL document for the Service however only describes:
              <s:element name="Insert">
              - <s:complexType>
              - <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" name="xmlPayload" type="s:string" /> 
                </s:sequence>
                </s:complexType>
                </s:element>
              Could you tell me whether the WSDL is not correct (and if so how I can fix it) or if the dataObject element is indeed redundant -= but what then is the way to tell the service which dataObject is being inserted?

              Thanks for your help.

              Lucas
              • 4. Re: How to set up Authentication for BAM WebServices
                391356
                Lucas,

                The webservice we are using expects dataobject by ID and not name, so instead of mentioning /HelloWorldDO, you should give its ID as _HelloWorldDO (please double check the dataobject ID through BAM architect). This should work.

                Thanks,
                Vishal
                • 5. Re: How to set up Authentication for BAM WebServices
                  Lucas Jellema
                  Hi Vishal,

                  Thanks for the prompt reply.

                  What I found out is that the WebService http://localhost:8888/OracleBAMWS/WebServices/DataObjectOperationsByName - mentioned in the doc - is not yet correct.

                  The WebService http://localhost:8888/OracleBAMWS/WebServices/DataObjectOperationsByID is available. However: when I send the following request message:
                  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                      <soap:Body xmlns:ns1="http://xmlns.oracle.com/bam">
                          <ns1:Insert>
                              <ns1:dataObject>_HelloWorldDO</ns1:dataObject>
                              <ns1:xmlPayload>              <DOInstance>
                                   <_instanceId>999</_instanceId>
                                   <_inputParameter>SomeName</_inputParameter>
                                </DOInstance>
                  </ns1:xmlPayload>
                          </ns1:Insert>
                      </soap:Body>
                  </soap:Envelope>
                  I get this error:
                  <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://xmlns.oracle.com/bam"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>Caught exception while handling request: deserialization error: unexpected XML reader state. expected: END but found: START: DOInstance</faultstring></env:Fault></env:Body></env:Envelope>
                  I believe I am following the instructions in the doc, but clearly I am doing something wrong here.

                  Can you tell me what could be wrong in my request message?

                  Lucas
                  • 6. Re: How to set up Authentication for BAM WebServices
                    391356
                    Okay, can you please give me the link of the documentation you are following?

                    -Vishal
                    • 7. Re: How to set up Authentication for BAM WebServices
                      Lucas Jellema
                      That is appendix F in the Oracle® Fusion Middleware
                      Developer’s Guide for Oracle SOA Suite
                      11g Release 1 (11.1.1)
                      E10224-01
                      April 2008
                      Beta Draft

                      However, whatever the doc says:

                      can you give me an example of a valid request to the Insert operation of the BAM DataObject WebService?

                      Lucas
                      • 8. Re: How to set up Authentication for BAM WebServices
                        543663
                        Hi Lucas,
                        Please follow the steps below for Inser Operation using WebServices:

                        1. http://host:port/OracleBAMWS/WebServices/DataObjectOperationsByID.
                        2. Enter uname/password
                        3. Click XML source option.
                        4. From the dropdown for operations select "Insert".
                        5. Replace the text in the text field with the below soap message.
                        ----------------------------------------------------------------------------------------------------------------
                        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                        <soap:Body xmlns:ns1="http://xmlns.oracle.com/bam">
                        <ns1:Insert>
                        <ns1:dataObject>/Samples/Employees</ns1:dataObject>
                        <ns1:xmlPayload>&lt;_Employees&gt;&lt;_Salesperson&gt;Deepan D&lt;/_Salesperson&gt;&lt;_Sales_Area&gt;BAM&lt;/_Sales_Area&gt;&lt;_Sales_Number&gt;12345&lt;/_Sales_Number&gt;&lt;/_Employees&gt;</ns1:xmlPayload>
                        </ns1:Insert>
                        </soap:Body>
                        </soap:Envelope>
                        -------------------------------------------------------------------------------
                        6. Expand "Show Transport Info".
                        7. Check "Enable Authentication" and enter uname/passwd.
                        8. Click Invoke.
                        9. Please verify that the response is as below for a successful insert operation:
                        -----------------------------------------------------------------------------------------------------------------
                        <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://xmlns.oracle.com/bam"><env:Body><ns0:InsertResponse><ns0:InsertResult>true</ns0:InsertResult></ns0:InsertResponse></env:Body></env:Envelope>
                        ------------------------------------------------------------------------------------------------------------------

                        ~Deepan
                        • 9. Re: How to set up Authentication for BAM WebServices
                          Lucas Jellema
                          Hi Deepan,

                          Thanks for your suggestion. I did what you prescribed. Unfortunately I ended up with this error-message:
                          <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://xmlns.oracle.com/bam"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>Caught exception while handling request: deserialization error: unexpected XML reader state. expected: END but found: START: _Employees</faultstring></env:Fault></env:Body></env:Envelope>
                          Any ideas?

                          I am surprised by the way, that you use /Sales/Employees as the dataObject value and not _Employees, which is the ID of the DataObject (and /Sales/Employees the name). Not that it makes any difference for the error I am getting.

                          I hope you have more thoughts on what might go wrong.

                          Lucas
                          • 10. Re: How to set up Authentication for BAM WebServices
                            391356
                            Lucas,

                            I noticed that if you try "XML Source" from test page, then you need to pass encoded values for "<", ">" like:

                            <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                            <soap:Body xmlns:ns1="http://xmlns.oracle.com/bam">
                            <ns1:Insert>
                            <ns1:dataObject>/Samples/Employees</ns1:dataObject>
                            <ns1:xmlPayload>&lt;_Employees&gt;&lt;_Salesperson&gt;Vishal&lt;/_Salesperson&gt;&lt;_Sales_Area&gt;Northeast&lt;/_Sales_Area&gt;&lt;_Sales_Number&gt;5671&lt;/_Sales_Number&gt;&lt;/_Employees&gt;</ns1:xmlPayload>
                            </ns1:Insert>
                            </soap:Body>
                            </soap:Envelope>

                            This should work for you. Otherwise, you could give the xml payload without encoded values from "HTML Form" page, i.e.
                            1. For dataobject, give /Samples/Employees
                            2. For XML Payload, give the following and things should work for you:
                            <_Employees>
                            <_Salesperson>Vishal</_Salesperson>
                            <_Sales_Area>Northeast</_Sales_Area>
                            <_Sales_Number>5671</_Sales_Number>
                            </_Employees>

                            Thanks,
                            Vishal
                            • 11. Re: How to set up Authentication for BAM WebServices
                              Lucas Jellema
                              Hi Vishal,

                              That indeed did the trick.

                              So encoding the <> is what this Test WebService page requires. Well, programmatic access - for example WebService calls from Java or PL/SQL - should hopefully not have those issues. Anyway, we got it to work.

                              Thanks very much for your quick help and your patience.

                              Best regards,

                              Lucas
                              • 12. Re: How to set up Authentication for BAM WebServices
                                391356
                                You are welcome, Lucas.

                                Actually, I realized after posting that first example in my submission has been decoded by Oracle Forum software, that is, all the entries in xmlpayload that contained "<" and ">" had been put as &lt; (ampersandlt;) and &gt;(ampersandgt;) by me but they showed up as < and > finally. But, anyway, you got the point.

                                -Vishal
                                • 13. Re: How to set up Authentication for BAM WebServices
                                  477172
                                  Can some one shed some light on the following issue

                                  BAM Tech Preview 4 - Jdeveloper Connection Error