Thanks Paul, I resolved my problem.

Ercan

The same approach will work. Please take a look at 
E4X http://en.wikipedia.org/wiki/ECMAScript_for_XML

Paul


On 16 April 2012 13:12, Ercan Can <canerca...@yahoo.com> wrote:

Hi Paul,
>
>
>i want to add logic in javascript code, for example;
>
>
><script language="js"><![CDATA[                                      
>                   
>                var city_Name = mc.getPayloadXML()..*::cityName.toString();   
>                var city_Code = 
>mc.getPayloadXML()..*::cityCodeto.toString();   
>
>                var limit_From = 
>mc.getPayloadXML()..*::limitFrom.toString();                      
>                var limit_To = mc.getPayloadXML()..*::limitTo.toString();      
>                     
>
>                var soapBody = "";
>                if(city_Name!="null")       soapBody = "<p:cityName 
xmlns:p=\"http://ws.wso2.org/dataservice%5C";>" 
+city_Name+"</p:cityName>";
>                if(city_Code!="null")       soapBody = "<p:cityCode 
xmlns:p=\"http://ws.wso2.org/dataservice\";>" 
+city_Code+"</p:cityCode>";
>
>    
>   
            soapBody = "<p:limitFrom 
xmlns:p=\"http://ws.wso2.org/dataservice\";>" 
+limit_From+"</p:limitFrom>"
>                                        + "<p:limitTo
 xmlns:p=\"http://ws.wso2.org/dataservice\";>" +limit_To+"</p:limitTo>";
>                
>                mc.setPayloadXML(
>                  <p:optGetCity xmlns:p="http://ws.wso2.org/dataservice";>
>                    {soapBody}
>                 </p:optGetCity>);]]>
>            </script>
>
>
>from this requirement(if value equal null element not sending) my code must bu 
>like.
>
>
>
>
>
>
>
>
>
>
>
>
>Ercan
>
>
>Its because you are using the {} syntax to embed a string into an XML.
>
>
>If you make a single XML and just use {} to embed the variables (city_Name) 
>etc, then it should work fine. If you notice, the  <p:optGetCity> is coming 
>out fine.
>
>
>e.g. 
>
>
>mc.setPayloadXML(
>                  <p:optGetCity xmlns:p="http://ws.wso2.org/dataservice";>
>                      <p:limitFrom> {limit_From}</p:limitFrom>
>                 </p:optGetCity>);]]>
>            </script>
>
>
>Paul
>
>
>On 16 April 2012 08:55, Ercan Can <canerca...@yahoo.com> wrote:
>
>Hi everybody,
>>
>>
>><script language="js"><![CDATA[                                      
>>                   
>>                var city_Name = mc.getPayloadXML()..*::cityName.toString();   
>>
>>                var limit_From = 
>>mc.getPayloadXML()..*::limitFrom.toString();                      
>>                var limit_To = mc.getPayloadXML()..*::limitTo.toString();     
>>                                                  
>>
>>                
>>                var soapBody = "<p:limitFrom 
>>xmlns:p=\"http://ws.wso2.org/dataservice%5C";>" +limit_From+"</p:limitFrom>"
>>
>>                                        + "<p:limitTo
 xmlns:p=\"http://ws.wso2.org/dataservice\";>" +limit_To+"</p:limitTo>";
>>                
>>                mc.setPayloadXML(
>>                  <p:optGetCity xmlns:p="http://ws.wso2.org/dataservice";>
>>                    {soapBody}
>>                 </p:optGetCity>);]]>
>>            </script>
>>
>>
>>
>>
>>
>>
>>this script was there in esb proxy, when i runnig proxy service everthing is 
>>ok, proxy send soap body  to dss and message like this
>>
>>
>><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
>>   <soapenv:Body>
>>        <p:optGetCity xmlns:p="http://ws.wso2.org/dataservice";>
>>                          &lt;p:limitFrom 
>>xmlns:p="http://ws.wso2.org/dataservice";>0&lt;/p:limitFrom>
>>                           &lt;p:limitTo 
>>xmlns:p="http://ws.wso2.org/dataservice";>100&lt;/p:limitTo>
>>         </p:optGetCity>
>>   </soapenv:Body>
>></soapenv:Envelope>
>>
>>
>>
>>
>>'<' character encoded   to '&lt', how can i resolve this problem.
>>
>>
>>Thanks a lot.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>_______________________________________________
>>Dev mailing list
>>Dev@wso2.org
>>http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
>
>
>-- 
>Paul Fremantle
>CTO and Co-Founder, WSO2
>OASIS WS-RX TC Co-chair, VP, Apache Synapse
>
>UK: +44 207 096 0336
>US: +1 646 595 7614
>
>blog: http://pzf.fremantle.org
>twitter.com/pzfreo
>p...@wso2.com
>
>
>wso2.com Lean Enterprise Middleware
>
>Disclaimer: This communication may contain privileged or other confidential 
>information and is intended exclusively for the addressee/s. If you are not 
>the intended recipient/s, or believe that you may have received this 
>communication in error, please reply to the sender indicating that fact and 
>delete the copy you received and in addition, you should not print, copy, 
>retransmit, disseminate, or otherwise use the information contained in this 
>communication. Internet communications cannot be guaranteed to be timely, 
>secure, error or virus-free. The sender does not accept liability for any 
>errors or omissions. 
>
>
>


-- 
Paul Fremantle
CTO and Co-Founder, WSO2
OASIS WS-RX TC Co-chair, VP, Apache Synapse

UK: +44 207 096 0336
US: +1 646 595 7614

blog: http://pzf.fremantle.org
twitter.com/pzfreo
p...@wso2.com

wso2.com Lean Enterprise Middleware

Disclaimer: This communication may contain privileged or other confidential 
information and is intended exclusively for the addressee/s. If you are not the 
intended recipient/s, or believe that you may have received this communication 
in error, please reply to the sender indicating that fact and delete the copy 
you received and in addition, you should not print, copy, retransmit, 
disseminate, or otherwise use the information contained in this communication. 
Internet communications cannot be guaranteed to be timely, secure, error or 
virus-free. The sender does not accept liability for any errors or omissions. 
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to