How to escape XML in BPEL?
I have a part of a outputmessage in an element HTML of xsd:any. This element contains HTML which i have to transform to escaped XML.
Therefore i created the following embedded java code.
String htmlContent = ((oracle.xml.parser.v2.XMLElement)getVariableData("l_GetBericht_Output","reply","/ns5:GetBerichtResponse/ns14:Bericht/ns14:HTML")).getFirstChild().getNodeValue() ;
htmlContent.replaceAll("<","<") ;
htmlContent.replaceAll(">",">") ;
setVariableData("TestHTMLContent",htmlContent);
Message in l_GetBericht_Output starts with;
<l_GetBericht_Output>
<part name="reply">
<sbtn:GetBerichtResponse>
<ns3:Bericht>
<ns3:Onderwerp>sdjasldjalsda</ns3:Onderwerp>
<ns3:Tekst/>
<ns3:HTML>
<HTML>
<div>
<p>Data</p>
<p>
<p>
de heer ...
The result of the selection in BPEL variable TestHTMLContent is empty though.
Anyone any thoughts ?
Is there a better way to transform XML to escaped XML ?
Why is my selection null ?
Cheers,
Peter
Try this.
xpath query for BPEL, escaping double quotes
Should work.
Thanks,
Vijay
Similar Messages
-
Escape XML Strings with JDK class
Hi,
can anyone tell me how to escape XML-Strings with classes of the JDK?
When searching I only was pointed to StringEscapeUtils from apache.commons.lang, but we would prefer to use the JDK instead of integrating an external lib.
Our aim is to escape an XML attribute, so a CDATA is not applicable for us in this case.
Thanks
JanI implemented it by myself:
public static String escapeXmlAttribute(String attributeValue) {
StringBuffer result = new StringBuffer();
for (int c = 0; c < attributeValue.length(); ++c) {
if (attributeValue.charAt(c) == '"') {
result.append(""");
} else if (attributeValue.charAt(c) == '&') {
result.append("&");
} else if (attributeValue.charAt(c) == '<') {
result.append("<");
} else if (attributeValue.charAt(c) == '>') {
result.append(">");
} else {
result.append(attributeValue.charAt(c));
return result.toString();
}{code} -
How to create XML inside BPEL process like below
<Main>
<psn:attr xmlns:psn="PSN:ML:6:0" name="Std_Fname"><psn:value>Any Value</psn:value></psn:attr>
<psn:attr xmlns:psn="PSN:ML:6:0" name="Std_Lname"><psn:value>Any Value</psn:value></psn:attr>
</Main>
Where Any Value may changes at runtime.
ThanksIn XML Fragment when I use the following code it doesn't get value of bpws:getVariableData("var1").
<Main>
<psn:attr xmlns:psn="PSN:ML:6:0" name="Std_Fname"><psn:value>bpws:getVariableData("var1")</psn:value></psn:attr>
<psn:attr xmlns:psn="PSN:ML:6:0" name="Std_Lname"><psn:value>bpws:getVariableData("var2")</psn:value></psn:attr>
</Main>
Any help? -
How to escape or remove the special characters in the xml element by regula
Hi members,
How to escape or remove the special characters in the xml element by regular expression in java??
For Example ,
<my:name> aaaa </my:name>
<my:age> 27 </my:age>
In the above example , i have to retrieve the value of the <my:name> Element(For examlpe -- i have to get "aaaa" from <my:name> tag)...
How to retreive this value by using DOM with XPATH in java
Thanks in AdvanceHi members,
I forget to paste my coding for the above question....This is my coding......In this display the error...... Pls reply ASAP.......
PROGRAM:
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
public class DOMReaderForXMP {
static Document doc;
static XPath xpath;
static Object result;
static NodeList nodes;
public DOMReaderForXMP() throws ParserConfigurationException, SAXException,
IOException, XPathExpressionException {
DocumentBuilderFactory domFactory = DocumentBuilderFactory
.newInstance();
domFactory.setNamespaceAware(true);
DocumentBuilder builder = domFactory.newDocumentBuilder();
doc = builder.parse("d:\\XMP.xml");
XPathFactory factory = XPathFactory.newInstance();
xpath = factory.newXPath();
public static void perform(String path) throws Exception {
result = xpath.evaluate(path, doc, XPathConstants.NODESET);
nodes = (NodeList) result;
public void check() throws Exception {
perform("//my:name/text()");
if (!nodes.item(0).getNodeValue().equals("application/pdf")) {
System.out.println("Mathces....!");
ERROR:
Exception in thread "main" net.sf.saxon.trans.StaticError: XPath syntax error at char 9 in {/my:name}:
Prefix aas has not been declared -
How to use XML fragment in BPEL?
Hello,
How to use XML fragment in BPEL process and whats the purpose of XML fragment ? And why we need it ??It is used to build up an XML fragment to the element on the target side...
please refer this link....
http://kr.forums.oracle.com/forums/thread.jspa?threadID=2252997&tstart=2
Thanks,
N -
How to convert xml data into html format in bpel
Hi ,
Can any one tel me how to conevrt xml into html in oracle bpel.
Does bpel support this functionality or not.
Regards,
Ana
Edited by: user10181991 on Apr 5, 2009 11:16 PMAna,
We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
Let me know if this helps. -
How to avoid escaped XML in "Set Workflow Variable" | "By Composing"
Hi, I have a proplem building an XML document using the action : "Set
Workflow Variable" | "By Composing" dialog.
The value of an element on the left pane is a variable in the right pane.
This variable contains a snippet of XML.
The problem is that when I print out the newly created document the XML I
added to it from the variable has been escaped :
In the example below I created a new xml document called new XML in its
child_2 element I set its value to the XML String "xml".
As you can see, the value of child 2 has been escaped. Is there a way to
turn this feature off ??
<Jan 30, 2002 10:02:35 AM GMT+10:00> <Info> <WLPI> <<wlpirequest>
<started>2002-01-30 10:02:35.009</started>
<requestor>wlpisystem</requestor>
<templateid>17</templateid>
<template-name>TEST ESCAPE XML</template-name>
<templatedefinitionid>17</templatedefinitionid>
<instanceid>10005</instanceid>
<actions>
<activatetask time="2002-01-30 10:02:35.009" taskid="2" name="Task 1"/>
<setvariable time="2002-01-30 10:02:35.009" variable="xml">
<StartActivity><businessRef>bus ref</businessRef><orderRef>order
ref</orderRef><activityId>Activity ID</activityId></StartActivity>
</setvariable>
<setvariable time="2002-01-30 10:02:35.011" variable="newXML">
<Root>
<Child_1>Child 1 data</Child_1>
<Child_2><StartActivity><businessRef>bus
ref</businessRef><orderRef>order
ref</orderRef><activityId>Activity
ID</activityId></StartActivity></Child_2>
</Root>
</setvariable>
<marktaskdone time="2002-01-30 10:02:35.011" taskid="2" name="Task 1"/>
<workflowdone time="2002-01-30 10:02:35.032" name="TEST ESCAPE XML"/>
</actions>
<completed>2002-01-30 10:02:35.037</completed>
</wlpirequest>
>Hi,
I also have this problem. It seems that a crude way around it, is to use a quick
fix via calling a business operation that performs string substitution to replace
the escaped entity references (<) and (>) with "<" ">". I have done this
and the approach works for me. Just be careful and make sure that the xml string
your are cleaning up doesn't contain any of these entity reference that you would
like to keep. Otherwise it will definitily break your xml. I hope you have that
luxury.
The easiest way to do is is to write a StringUtil class with a static replace
function, replace(source, old, new), expose this method as a business operation,
then call twice to convert your xml string.
I know this is pretty pathetic, but might help in the meanwhile until BEA provides
this functionality.
Lukas
"Smita Agarwal" <[email protected]> wrote:
>
Hi Paul,
I am getting the exact same problem , have you found a solution for
it??
It will be great to know if this problem is solved.
I am using WLI2.1 sp1 and WLS6.1 sp2, even with these two configuration
this problem
is occuring
cheers,
Smita
"Paul Rooney" <[email protected]> wrote:
Hi, I have a proplem building an XML document using the action : "Set
Workflow Variable" | "By Composing" dialog.
The value of an element on the left pane is a variable in the rightpane.
This variable contains a snippet of XML.
The problem is that when I print out the newly created document theXML
I
added to it from the variable has been escaped :
In the example below I created a new xml document called new XML inits
child_2 element I set its value to the XML String "xml".
As you can see, the value of child 2 has been escaped. Is there a way
to
turn this feature off ??
<Jan 30, 2002 10:02:35 AM GMT+10:00> <Info> <WLPI> <<wlpirequest>
<started>2002-01-30 10:02:35.009</started>
<requestor>wlpisystem</requestor>
<templateid>17</templateid>
<template-name>TEST ESCAPE XML</template-name>
<templatedefinitionid>17</templatedefinitionid>
<instanceid>10005</instanceid>
<actions>
<activatetask time="2002-01-30 10:02:35.009" taskid="2" name="Task
1"/>
<setvariable time="2002-01-30 10:02:35.009" variable="xml">
<StartActivity><businessRef>bus ref</businessRef><orderRef>order
ref</orderRef><activityId>Activity ID</activityId></StartActivity>
</setvariable>
<setvariable time="2002-01-30 10:02:35.011" variable="newXML">
<Root>
<Child_1>Child 1 data</Child_1>
<Child_2><StartActivity><businessRef>bus
ref</businessRef><orderRef>order
ref</orderRef><activityId>Activity
ID</activityId></StartActivity></Child_2>
</Root>
</setvariable>
<marktaskdone time="2002-01-30 10:02:35.011" taskid="2" name="Task
1"/>
<workflowdone time="2002-01-30 10:02:35.032" name="TEST ESCAPE XML"/>
</actions>
<completed>2002-01-30 10:02:35.037</completed>
</wlpirequest>
> -
How to escape special characters in Simple Transformation
Hi Experts,
I have got a problem to get a well formed xml document from the below simple transformation. The content of maktx contains
special characters like & <, which are not allowed in a well formed XML-Document. But the result of the Simple Transformation
contains this charcters even after the transformation as you can the in the result below. Has anyone a hint how to escape the
characters included in the maktx.
The transformation for maktx, should be something like
Before: Material & < TEST
After: Material & < TEST
Report wihich calls the simple transformation
types:
BEGIN OF t_mat,
matnr type matnr,
maktx type maktx,
end of t_mat.
Data:
mat type t_mat,
xml_stream type xstring.
START-OF-SELECTION.
mat-matnr = '4711'.
mat-maktx = 'Material & < Test'.
CALL TRANSFORMATION ztest_st2
SOURCE mat = mat
RESULT XML xml_stream.
CALL FUNCTION 'DISPLAY_XML_STRING'
EXPORTING xml_string = xml_stream.
Simple Transformation
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="MAT"/>
<tt:template>
<Leistungsschild>
<CHARACT> MATNR </CHARACT>
<CHARACT_DESCR> Materialnummer </CHARACT_DESCR>
<VALUE tt:value-ref="MAT.MATNR"/>
<CHARACT> MAKTX </CHARACT>
<CHARACT_DESCR> Materialkurztext </CHARACT_DESCR>
<VALUE tt:value-ref="MAT.MAKTX" />
</Leistungsschild>
</tt:template>
</tt:transform>
RESULT
<?xml version="1.0" encoding="utf-8" ?>
<Leistungsschild>
<CHARACT>MATNR</CHARACT>
<CHARACT_DESCR>Materialnummer</CHARACT_DESCR>
<VALUE>4711</VALUE>
<CHARACT>MAKTX</CHARACT>
<CHARACT_DESCR>Materialkurztext</CHARACT_DESCR>
<VALUE>Material & < Test</VALUE> </Leistungsschild>Hi Sandra,
First of all thaks for your quick answer to my problem.
I see what you mean and get the same result, if I am using data-type string instead of xstring. But the recommendation in the XML-Books of SAP is to use XSTRING to save memory and circumflex problems between Codepages, when writing the XML-Stream to a filesystem.
As you can see in the code abvoe I am using a SAP-FM to display the XML-Stream and this FM works only with XSTRING´s,
that is one reason why I don´t understand that it displays it in the wrong way.
Even the Debugger shows me for the XSTRING the wrong result. Does all that mean that the escaping will not be applyed if you are working with XSTING´s?? -
How to use XML on another server?
I need help figuring out how to consume XML from another
domain. It's a domain that is providing search functionality for a
website. The domain indexes my site, and I can "post" searches to
an URL with my search terms URL-escaped. It returns an XML
document. I want to use Spry to consume that XML.
I'm pretty experienced consuming XML and using it in Spry
pages, but to date have not done anything that crosses domains. I
will have access to Perl on the production box that hosts my site,
with a remote chance that I could get PHP enabled. This is a public
web server for a very very large financial company, so my choices
of what can go on a production server outside our firewall are
limited by corporate policy.
What are the basic steps that need to happen? Can someone
bullet-point how this might work from one end to the other? I have
the basic theory down of what needs to happen, but not much else at
this point.
Here is what I understand:
1 - user fills in search form and hits enter
2 - form posts to a Perl script on my box
3 - Perl takes the form variables and appends them to a URL
request to the 3rd party search domain
4 - 3rd party search company returns an xml file
5 - not sure what Perl needs to do here with the xml so that
my HTML page with Spry can read it....it does something, let's just
say
6 - Perl writes out a page, based on a template in my site
that then consumes the XML that is somehow available on my domain
now...
This raises so many questions...like if I save the results
XML on my server, how do I get rid of them after they are consumed
and also how do I prevent other sessions from accessing that "saved
copy" of XML...I know I'm thinking wrong here. That can't be how
it's done...Hence...my question about all this.
Where do I start?
Thanks,
Douguser12004297 wrote:
thank you so much - however on the source database I dropped tables and users- then I did an "alter system switch logfile;" - copied the archivelogs to the / test DRP and loaded the archivelogs and the users and tables were not dropped like i did in source
RMAN> tartup mount
Oracle instance started
database mounted
Total System Global Area 1119043584 bytes
Fixed Size 2227624 bytes
Variable Size 620757592 bytes
Database Buffers 469762048 bytes
Redo Buffers 26296320 bytes
RMAN> CATALOG START WITH '/oradb1/backup';
using target database control file instead of recovery catalog
searching for all files that match the pattern /oradb1/backup
List of Files Unknown to the Database
=====================================
File Name: /oradb1/backup/1_345_819727387.dbf
Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /oradb1/backup/1_345_819727387.dbf
RMAN> recover database;
Starting recover at 20-NOV-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=249 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 20-NOV-13
RMAN> alter database open;
database opened
RMAN
Simply making the database aware of the archivlogs does NOT mean rman will determine they need to be used for a specific recovery operation. What all had you done to/with this database prior to this? Keep firmly in mind the effect of any OPEN RESETLOGS. -
How to Post XML Messages with SOAP Headers to a Trading Partner URL
Hi All,
Greeting to the Oracle B2B Community. We are currently working on how to post a Custom XML Message with SOAP Headers to a Trading Partner URL. I would really appreciate if anybody could provide me some inputs or links to some documentation on how to achieve the above requirement. The details are below:
1. Our Internal Application generates a Flat File (PO Extract).
2. The Extract then needs to be transformed to an XML Message. We are planning to use BPEL to do the transformation to XML Message.
3. Once it is transformed to an XML message it needs to be posted to the Trading Partner URL as an HTTP Post and with SOAP Headers.
We are planning to use B2B to do the posting but I am not sure on how to do the set-ups and what all parameter files in B2B needs to be updated in order to achieve the same. Also it is mandatory that we send SOAP Headers in the XML Message.
Thanks In Advance for your help.
Regards,
DibyaHello Dibya,
As you are already doing the transformation from Flat file to XML in BPEL which is typically the capability of B2B, please use the Soap binding in BPEL to send the document to Trading partner.
Rgds,Ramesh -
How to escape & symbol in Update statement
Hi all,
How to escape & symbol in Update statement..
Below is my update statement which contains lot of & symbols...
UPDATE ContentItem SET ContentData =
'<:'
where ContentItemId = 398
if i run this query it asks input value for lt..
Can anyone give the suggestions please.. Its very urgent..
Cheers,
Moorthy.GSHey all,
Thanks for your reply.
But i am getting error for below statement
set define off;
UPDATE ContentItem SET ContentData =
'<?xml version="1.0" encoding="utf-16"?>
<contentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="398" resizable="false" contentTypeId="15" parentContentTypeId="0" sortOrder="0" width="0" height="0" xsltFileId="" createDate="0001-01-01T00:00:00" startDate="2006-12-06T00:00:00" endDate="2010-12-31T00:00:00" publishedDate="0001-01-01T00:00:00" CategoryId="0" DotNetClassType="HPCi.OnlineContentDelivery.Core.ContentItem" DotNetAssVersion="1.0.0.0">
<title>Executive_Photos</title>
<CampaignName />
<files />
<textItems>
<textItem type="" linkName="" linkUrl="" identifier="Body" dataDocFileId=""><?xml version="1.0" encoding="utf-16"?>
<contentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="40" contentTypeId="10" parentContentTypeId="0" sortOrder="0" createDate="0001-01-01T00:00:00" startDate="2006-04-04T00:00:00" endDate="2006-05-06T00:00:00" publishedDate="0001-01-01T00:00:00" DotNetClassType="HPCi.OnlineContentDelivery.Core.ContentItem" DotNetAssVersion="1.0.0.0">
<title>Image Gallery</title>
<files />
<textItems>
<textItem type="" linkName="" linkUrl="" identifier="Body" dataDocFileId="" xsltFileId=""><!-- BEGIN CODE FOR THE TOP CONTROL -->
<script language="javascript" type="text/javascript">
function showImage(sImgId, sTargetImgPath)
document.getElementById("imgLargeImage").src = sTargetImgPath;
</script>
<div id="topThumbContainer" style="float:left; width:100%;">
<div id="divThumbs" style="float:left;">
<table>
<tr>
<td width="84px" >
<div id="divThumbImage1" class="divThumbImage" onClick="javascript:showImage(''ThumbImg1'', ''Images/bio/BobMetz_lg.jpg'');">
<img id="ThumbImg1" src="Images/bio/BobMetz_sm.jpg" width="63" height="85" />
</div>
<div id="divThumbText1" style="text-align:center;">Bob Metz</div>
</td>
<td>
<div id="divThumbImage3" class="divThumbImage" onClick="javascript:showImage(''ThumbImg3'', ''Images/bio/Crawford_lg.jpg'');">
<img id="ThumbImg3" src="Images/bio/Crawford_sm.jpg" width="63" height="85" />
</div>
<div id="divThumbText3" style="text-align:center;">David Crawford</div>
</td>
</tr>
<tr>
<td width="84px" >
<div id="divThumbImage2" class="divThumbImage" onClick="javascript:showImage(''ThumbImg2'', ''Images/bio/JamieGallo_lg.jpg'');">
<img id="ThumbImg2" src="Images/bio/JamieGallo_sm.jpg" width="63" height="85"/>
</div>
<div id="divThumbText2" style="text-align:center;">Jamie Gallo</div>
</td>
<td >
<div id="divThumbImage4" class="divThumbImage" onClick="javascript:showImage(''ThumbImg4'', ''Images/bio/Mayfield_lg.jpg'');">
<img id="ThumbImg4" src="Images/bio/Mayfield_sm.jpg" width="63" height="85"/>
</div>
<div id="divThumbText4" style="text-align:center;">Arlene Mayfield</div>
</td>
</tr>
<tr>
<td width="84px" >
<div id="divThumbImage5" class="divThumbImage" onClick="javascript:showImage(''ThumbImg5'', ''Images/bio/Turnbull_lg.jpg'');">
<img id="ThumbImg5" src="Images/bio/Turnbull_sm.jpg" width="63" height="85" />
</div>
<div id="divThumbText5" style="text-align:center;">Robert Turnbull</div>
</td>
<td>
<div id="divThumbImage6" class="divThumbImage" onClick="javascript:showImage(''ThumbImg6'', ''Images/bio/hessels_lg2.jpg'');">
<img id="ThumbImg6" src="Images/bio/hessels_sm2.jpg" width="63" height="85" />
</div>
<div id="divThumbText6" style="text-align:center;">Jane T. Hessels</div>
</td>
</tr>
<tr>
<td width="84px" >
<div id="divThumbImage7" class="divThumbImage" onClick="javascript:showImage(''ThumbImg7'', ''Images/bio/bauz_lg.jpg'');">
<img id="ThumbImg7" src="Images/bio/bauz_biopic.jpg" width="63" height="85" />
</div>
<div id="divThumbText7" style="text-align:center;">Melanie Wernick</div>
</td>
<td>
<div id="divThumbImage8" class="divThumbImage" onClick="javascript:showImage(''ThumbImg8'', ''Images/bio/child_lg.jpg'');">
<img id="ThumbImg8" src="Images/bio/child_biopic.jpg" width="63" height="85" />
</div>
<div id="divThumbText8" style="text-align:center;">Mike Child</div>
</td>
</tr>
<!--<tr>
<td>
<div id="divThumbsRight">
<img src="Images/AG5_About_Us_Photo_Gallery_Camera.gif" alt="Image of Camera" border="0" height="150" />
</div>
</td> -->
</tr>
</table>
</div>
</div>
<!-- END CODE FOR THE TOP CONTROL --></textItem>
<textItem type="" linkName="" linkUrl="" identifier="NameTitle" dataDocFileId="" xsltFileId="">Images</textItem>
</textItems>
</contentItem></textItem>
</textItems>
</contentItem>'
where ContentItemId = 398
Error is "SQL Error: ORA-01704: string literal too long"
My contentdata column is CLOB datatype.
Pls help me....
Moorthy.GS -
how to escape <,> in xml string to < ,
>.is it possible to convert the entire xml string into this
format
ex:
<root> <sample><id> 89
</id></sample></root>
this has to be converted into
< root>. < sample>. <
id>. 89 < /id>. < /sample>.
< /root>.myString="<root> <sample><id> 89
</id></sample></root>";
myString.split("<").join("<"); -
How to refresh XML file from my client machine
Hai All
I have temp.XML and temp.XSL template in our server machine.
when i give a print from client machine first time it gives the record,and next time it did not get refresh.Always it shows the previous records in the browser.But when i go into the server machine and click on temp.xml,it shows the current record(correct records)
How to refresh XML file from my client machine?
Regards
DhinaYou never delete a Time Machine backup by dragging it to the Trash. You are supposed to use the TM application to manage the backups. What you will need to do now is to simply erase the drive using Disk Utility.
-
How to send XML using UTL_HTTP
I am trying to workout how to send XML data to a webserver using UTL_HTTP but am not getting any reply
I need to submit the following XML document to a server "http://api.fastsms.co.uk/api/xmlapi.php" Their instructions are "The XML Document should be posted unencoded, with a UTF-8 character set as parameter 'xml'"
If I submit the following XML on their test form
<?xml version="1.0"?>
<apirequest version="1">
<user>
<username>**USER**</username>
<password>**PASSWORD**</password>
</user>
<application>
<name>Example Application</name>
<version>1.0</version>
</application>
<inboundcheck lastid="10711399"/>
</apirequest>
I get an XML response back with the messages in my inbox.
This is the code I am trying to use to accomplish the same from PL/SQL : I know a response is coming back as there is header information - just no content. What am I doing wrong ?
l_xml VARCHAR2(5000);
req utl_http.req;
resp utl_http.resp;
header_name VARCHAR2(256); -- Response header name
header_value VARCHAR2(1024); -- Response header value
response_text VARCHAR2(4000); -- Response body
l_url VARCHAR2(100);
BEGIN
l_xml := 'xml=<?xml version="1.0"?>';
l_xml := '<apirequest version="1">';
l_xml := '<user>';
l_xml := '<username>**USER**</username>';
l_xml := '<password>**PASSWORD**</password>';
l_xml := '</user>';
l_xml := '<application>';
l_xml := '<name>Example Application</name>';
l_xml := '<version>1.0</version>';
l_xml := '</application>';
l_xml := '<inboundcheck lastid="10711399"/>';
l_xml := '</apirequest>';
-- Open HTTP connection
l_url := 'http://api.fastsms.co.uk/api/xmlapi.php';
req := utl_http.begin_request(l_url,'POST',utl_http.HTTP_VERSION_1_1);
-- Set headers for type and length
utl_http.set_header(req,'Content-Type','application/x-www-form-urlencoded');
utl_http.set_header(req,'Content-Length',to_char(length(l_xml)));
-- Write parameter
utl_http.write_text(req,l_xml);
-- Read response file
resp := utl_http.get_response(req);
-- Print out the response headers
FOR i IN 1 .. utl_http.get_header_count(resp) LOOP
utl_http.get_header(resp,i,header_name,header_value);
logging_pkg.info(header_name || ': ' || header_value);
END LOOP;
-- Print out the response body
BEGIN
LOOP
utl_http.read_text(resp,response_text);
logging_pkg.info(response_text);
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
logging_pkg.info('End of body');
END;
-- close http connection
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
Cheers,
BrentHi Billy
Yikes - how embarassing ! Thanks for pointing out my beginners mistake there. I've fixed my code - and also implemented the substitutions of parameters like you suggested - I like that approach.
Unfortunately the end result is no better - the line
utl_http.read_text(resp,response_text);
Still returns nothing back
The headers that are coming back are
Date: Thu, 04 Jul 2013 08:31:56 GMT
Server: Apache/2.2.16 (Ubuntu)
X-Powered-By: PHP/5.3.3-1ubuntu9.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Connection: close
I guess I will need to try chasing it with the fastsms vendor so see if they can check my incoming request and see if there are any glaring problems. I know the xml is correct as I am now logging the xml string just before I send it and when I take that string and put it in their test form it works perfectly - something else in the puzzle is missing. I've had no experience using utl_http before - perhaps it's no possible to read the xml repsonse using this ?
Anyway, thanks for your help Billy.
ps - How do you paste your code into your message to get that formatting ?
Cheers,
Brent -
How to escape a single quotes from a string of dynamic sql clause?
if a single quotes exist in a dynamic sql clause for a string,
like
v_string :='select tname from tab where tabtype='table'',
there tabtype='table' will conflict with the single quote ahead.
could somebody tell me how to escape this single quotes?
thanks for your tips,
frederickfredrick,
To represent one single quotation mark within a literal, enter two single quotation marks. For example :
v_string :='select tname from tab where tabtype=''table'''
Regards,
Srinivas
Maybe you are looking for
-
Can't boot from IDE hard drives
Just purchased a barebones system with a KEN NEO Platinum board running an AMD 64 3400+. Tried to install old Maxtor hard drive (40 gb) into new system and a blue screen pops up for less than one second and reboots PC. I can't read the blue screen bu
-
Ntttcp doesn't run traffic on first command execution
Hi, I noticed some weird behavior of ntttcp_x64.exe which sometimes doesn't run any traffic on the first time it's been executed. Waiting for it to complete, shows that 0.000MB/s were transmitted. (no traffic was actually running) Re-running right af
-
I have songs on my computer i dont have on my phone
i have downloaded eminem curtain call and the eminem show.on my iphone, on neither of the albums i have sing for the moment. but wierd enough it is on my computer. how do i get sing for the moment on my iphone 4s, i havetried to sync my phone with it
-
Some question about Web service
Hi experts, I have created a Web service about Function Module 'BAPI_EXCHANGERATE_GETDETAIL'.Now I plan to use Transaction code 'WSADMIN' to create a WSDL.But the display result of IE tell me my host could not be resolved by DNS.I don't know how to s
-
I originally set password protection for my site via the function in inspector. I wanted to remove the password protection, so just unchecked the checkbox, made sure it was removed from all pages, saved and republished ... ... it didn't work! Reading