tag:blogger.com,1999:blog-6139250371277978964.post3547874992190460268..comments2023-06-25T04:23:18.275-04:00Comments on Application Express Nuggets: The New flex_ws_api and SOAP 1.2 ExampleJason Straubhttp://www.blogger.com/profile/12627913070109819002noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-6139250371277978964.post-59351632339847583112010-08-29T19:38:03.872-04:002010-08-29T19:38:03.872-04:00Hello Jason,
My problem is as same as yours. I wo...Hello Jason,<br /><br />My problem is as same as yours. I would like to use beehive objects of apex. Your sample code is very good, but there is a big problem.<br />The Oracle does not support the soap webservice only the RESTful webservice has been supported since beehive 2. I tried your flex_ws_api, but it isn't working for me.<br />My code is: (i created a test user, user name: testuser1 and password: asdfg12 , it is allowed to try it)<br />I get allways http 400 error. What is the problem? <br /><br />declare<br /> l_signature varchar2(4000);<br /> l_response clob;<br /> l_c clob;<br /> l_parm_name_tab wwv_flow_global.vc_arr2;<br /> l_parm_val_tab wwv_flow_global.vc_arr2;<br /> i number;<br /> darab varchar2(4000);<br /> c number;<br /> l_user varchar2(4000);<br /> l_pwd varchar2(4000);<br /> l_url varchar2(4000);<br />begin<br /> l_user := 'testuser1';<br /> l_pwd := 'asdfg12';<br /> l_url := 'http://beehive.isolutions.hu:7777/';<br /><br /> l_parm_name_tab := apex_util.string_to_table('Accept:Content%2DType:Authorization');<br /> l_parm_val_tab := apex_util.string_to_table('application%2Fjson:application%2Fjson:Basic');<br /> l_response := flex_ws_api.make_rest_request(<br /> p_url => l_url||'comb/v1/d/session/login',<br /> p_http_method => 'POST',<br /> p_username => l_user,<br /> p_password => l_pwd,<br /> p_parm_name => l_parm_name_tab,<br /> p_parm_value => l_parm_val_tab );<br /> l_c := l_response;<br /><br /> htp.p('++++++++++++++++++++++++++++++++++++++++++++++++');<br /> for i in 0..(floor(DBMS_LOB.GETLENGTH(l_c)/2000)+1) loop<br /> darab:=dbms_lob.substr(l_c,2000,1+(i-1)*2000);<br /> htp.p(darab);<br /> end loop;<br /> htp.p('++++++++++++++++++++++++++++++++++++++++++++++++');<br /> <br /> l_parm_name_tab := apex_util.string_to_table('Accept');<br /> l_parm_val_tab := apex_util.string_to_table('application%2Fxml');<br /> l_response := flex_ws_api.make_rest_request(<br /> p_url => l_url||'comb/v1/d/session/anticsrf',<br /> p_http_method => 'GET',<br /> p_parm_name => l_parm_name_tab,<br /> p_parm_value => l_parm_val_tab );<br /> l_c := l_response;<br /><br /> htp.p('++++++++++++++++++++++++++++++++++++++++++++++++');<br /> for i in 0..(floor(DBMS_LOB.GETLENGTH(l_c)/2000)+1) loop<br /> darab:=dbms_lob.substr(l_c,2000,1+(i-1)*2000);<br /> htp.p(darab);<br /> end loop;<br /> htp.p('++++++++++++++++++++++++++++++++++++++++++++++++');<br />end;<br /><br /><br />Regard Viktor, Juhász (viktor.juhasz@isolutions.hu)Juhász Viktorhttps://www.blogger.com/profile/08916515934660864009noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-21751102146822732972010-04-06T14:57:42.319-04:002010-04-06T14:57:42.319-04:00Véronique:
Sometimes when I make changes at the b...Véronique:<br /><br />Sometimes when I make changes at the blog site with the code formatter, some of the characters get corrupted. I have created a project at:<br /><br />https://flex-ws-api.samplecode.oracle.com/<br /><br />You only need an OTN account to sign-in. Can you get the package from there and try to compile it?<br /><br />Regards,<br /><br />JasonJason Straubhttps://www.blogger.com/profile/12627913070109819002noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-85768475031933524142010-04-06T11:04:09.448-04:002010-04-06T11:04:09.448-04:00I received an error while compiling the package:
...I received an error while compiling the package:<br /><br />ERROR line 103, col 27, ending_line 103, ending_col 27, Found '=', Expecting: ( * + - AT CURSOR DAY identifier MOD MODEL MULTISET NOT NULL REM string THE WHEN YEAR -or- : @ CASE CONNECT_BY_ROOT decimal number EXISTS FALSE float integer NEW PRIOR SQL TRUE -or- % . [ -or- (+) -or- ** -or- / -or- || -or- AND -or- OR -or- , -or- )<br /><br />It doesn't seem to like the line:<br />while (pos < parameter="'NLS_CHARACTERSET';" l_db_charset =" 'AL32UTF8'" proxy =""> apex_application.g_proxy_server);<br /><br />Is it because i'm in 10g ?Unknownhttps://www.blogger.com/profile/02370109645969327006noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-90114706636939037002009-02-26T10:37:00.000-05:002009-02-26T10:37:00.000-05:00Given the number of tags and bloggers complaints, ...Given the number of tags and bloggers complaints, I have forwarded the raw response to your yahoo account.Tonyhttps://www.blogger.com/profile/12184354575866057215noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-57381150230407277202009-02-26T09:26:00.000-05:002009-02-26T09:26:00.000-05:00Tony:I goofed up on my escaping in the example abo...Tony:<BR/><BR/>I goofed up on my escaping in the example above, wherever you see &37;, that should be a %.Jason Straubhttps://www.blogger.com/profile/12627913070109819002noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-9757727636910513442009-02-26T09:24:00.000-05:002009-02-26T09:24:00.000-05:00Tony:It seems that XML DB expects that any whitesp...Tony:<BR/><BR/>It seems that XML DB expects that any whitespace in a namespace to be escaped with &37;20. It is possible that the response you are getting back is escaped with &37;20, so <FetchResponse xmlns="urn: WA.Ecy.ADS.FacilitySite.Services"><BR/> might actually be <FetchResponse xmlns="urn:&37;20WA.Ecy.ADS.FacilitySite.Services">. If that is the case, then the following code snippet shows how you could get the facility id:<BR/><BR/>set serveroutput on<BR/>declare<BR/> l_xml xmltype;<BR/> l_facilityid number;<BR/>begin<BR/> l_xml := xmltype.createxml('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><BR/><s:Header><BR/><ActivityId CorrelationId="12855f8e-d2be-40c7-81d8-fafa3cf9a779" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">d24174d3-e095-460a-b9f8-2bae66efe813</ActivityId><BR/></s:Header><BR/><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><BR/><FetchResponse xmlns="urn:&37;20WA.Ecy.ADS.FacilitySite.Services"><BR/><FacilitySiteId>99997167</FacilitySiteId><BR/></FetchResponse><BR/></s:Body><BR/></s:Envelope>');<BR/><BR/> dbms_output.put_line('facility id: '||flex_ws_api.parse_xml(l_xml,'//FetchResponse/FacilitySiteId/text()','xmlns="urn:&37;20WA.Ecy.ADS.FacilitySite.Services"'));<BR/><BR/>end;<BR/>/<BR/><BR/>Is there a way for you to view the raw response (in SOAPUI or some other tool) and confirm whether that white space in the namespace of FetchResponse is escaped?<BR/><BR/>JasonJason Straubhttps://www.blogger.com/profile/12627913070109819002noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-37352138946955556432009-02-25T15:43:00.000-05:002009-02-25T15:43:00.000-05:00Jason -There really is a space in the URN. I don'...Jason -<BR/><BR/>There really is a space in the URN. I don't have any control over this service, and so changing it is not a possibility.<BR/><BR/>As for the database, I am running 11.1.0.6 on Windows.Tonyhttps://www.blogger.com/profile/12184354575866057215noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-90818289282943545302009-02-25T15:10:00.000-05:002009-02-25T15:10:00.000-05:00Tony:Regarding the namespace of the FetchResponse ...Tony:<BR/><BR/>Regarding the namespace of the FetchResponse node, xmlns="urn: WA.Ecy.ADS.FacilitySite.Services" is there really a space between urn: and WA.Ecy.ADS.FacilitySite.Services? Is it possible to change the namespace of the service so that it does not have a space in it? Finally, what version of the database are you on?<BR/><BR/>JasonJason Straubhttps://www.blogger.com/profile/12627913070109819002noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-57683863792603789732009-02-25T14:31:00.000-05:002009-02-25T14:31:00.000-05:00Tony:I am trying to figure out the proper XPath ex...Tony:<BR/><BR/>I am trying to figure out the proper XPath expression now. Hopefully I will have it soon.<BR/><BR/>JasonJason Straubhttps://www.blogger.com/profile/12627913070109819002noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-16450933537182873132008-12-23T14:07:00.000-05:002008-12-23T14:07:00.000-05:00I am still struggling with the parsing of the mess...I am still struggling with the parsing of the messages.<BR/><BR/>I have a SOAP response that looks like this (it is from a microsoft WCF service)<BR/><BR/><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><BR/> <s:Header><BR/> <ActivityId CorrelationId="12855f8e-d2be-40c7-81d8-fafa3cf9a779" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">d24174d3-e095-460a-b9f8-2bae66efe813</ActivityId><BR/> </s:Header><BR/> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><BR/> <FetchResponse xmlns="urn: WA.Ecy.ADS.FacilitySite.Services"><BR/> <FacilitySiteId>99997167</FacilitySiteId><BR/> </FetchResponse><BR/> </s:Body><BR/></s:Envelope><BR/><BR/>I am storing these results in a local variable l_response xmltype<BR/><BR/>If I use the parse_xml to get the FacilitySiteId is get an error:<BR/><BR/>l_id := parse_xml (l_response,'/FetchResponse/FacilitySiteId','xmlns="http://microsoft.com/wsdl/type/"');<BR/><BR/><BR/>ORA-30625 method dispatch on null self argument is disallowed<BR/>ORA-6512 FLEX_WS_API line 349<BR/><BR/>I even tried storing the results in a table and performing the query <BR/>select extractvalue(x,'/FetchResponse/FacilitySiteId','xmlns="http://microsoft.com/wsdl/types/"')<BR/>from ws_results<BR/><BR/><BR/>This just returned a null.<BR/><BR/>I don't know if the problem is that this isn't an expected xml document (i.e. doesn't start with <BR/>?xml version="1.0" encoding="UTF-8" ?)Tonyhttps://www.blogger.com/profile/12184354575866057215noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-70086800742654443292008-11-11T11:07:00.000-05:002008-11-11T11:07:00.000-05:00Tony:I usually use (and did so in this case) the r...Tony:<BR/><BR/>I usually use (and did so in this case) the report on collection containing web service result wizard. In this case, since it is a purely PL/SQL implementation, I created a dummy manual web reference and populated the collection name with GETWORKSPACES_RESPONSE. Choose Manually Created as the Web Reference Type when running the report on on web service result wizard. Most likely you can leave the defaults of Document for SOAP Style and Literal for Message format. Then you need to supply the XPath to the node that you want to report on. You can get the XML response envelope by clicking the session link in the developer toolbar, (after running a page that invokes the service), choose Collections, and then view the source of that page. The XML respone will be contained in that source.<BR/><BR/>I then take that XML response and paste it into an application like XML Spy, which allows me to look at the data in a grid view, and right click on a cell to get the XPath. So in this example, I determined the XPath to the node I was interested in as /GetWorkspacesResponse/return/libraryIDList. The message namespace can also be determined from the XML response, http://oracle.bee.platform.webservice/. Then you just supply the parameter names under the reporting node, in this case they were id, name, and description. The wizard will create the proper SQL statement for you.<BR/><BR/>For the report on page 2, I simply copied the region from page 1 and changed the XPath to the node to report on to //GetDocumentsInFolderResponse/return and changed the parameter references to /contentID/id, /content/name, /mimeMultipartType. I determined this from inspecting the XML response from the service.<BR/><BR/>Hope that helps.<BR/><BR/>Regards,<BR/><BR/>JasonJason Straubhttps://www.blogger.com/profile/12627913070109819002noreply@blogger.comtag:blogger.com,1999:blog-6139250371277978964.post-15094432826501452302008-11-10T17:39:00.000-05:002008-11-10T17:39:00.000-05:00Just wanted to take a minute to tell you how much ...Just wanted to take a minute to tell you how much I appreciate the effort and time you have put into this package. I, for one, am appreciative of your efforts.<BR/><BR/>I'll be testing this out myself in the next week or so.<BR/><BR/>One thing I would also appreciate is a resource or tip on how to construct the queries against the collection - based on the returned SOAP response, what is the best method to determine how to use the extract value to generate your columns.Tonyhttps://www.blogger.com/profile/12184354575866057215noreply@blogger.com