Can a Web Service be Consumed from within JSX
Hi all,
In CS5, can a web service be consumed from within JSX, and if so - how?
TIA,
mlavie
Kris,
Thanks! Exactly what I needed!
mlavie
Similar Messages
-
Creating a web service to consume price of a particular stock from ???
hey,
i'm new, donno much about web services in terms of writing it, but i do have some knowledge about wat it actually does...
im here becuz i wanna create a web service to consume the price of a particular stock and then store the closing price along with the dates into a database
now, im abit lost here.. how do i know where to get the information from? is it possible for me to write a web service to communicate with Yahoo! Finance or any other sites which allows consumption of information?If you are talking about simple XML transformation of the SOAP payload between the client calling your service and the final destination of the message you are routing, the ESB approach may be a better fit.
If you have more complex transformation in mind, with major processing and rework of the message in the intermediary, you may be better of with using the POJO approach. Write your service and embed a callout to the other service in your implementation. If the two services share the same Java Model, you may even be able to re-use the same Java Bean.
To get SOAP Element instead of Java bean, you just need to use the noDataBinding option with either genProxy and topDownAssemble (or assemble). See the WS-Guide [1] for details. Chapter 18 will give you all the details about the different WSA command line parameters.
Hope this helps,
-Eric
[1] http://download-west.oracle.com/docs/cd/B31017_01/web.1013/b28974/toc.htm -
Create MII transaction & MII Web Service and consume them in ABAP
Hi,
there is a document from Pradip Ray (SAP Labs India) published on SDN:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/208239ac-3161-2b10-f29a-abec6754942e
He explains how to build a transaction in MII, expose it as a web service then consume it in an ABAP program by generating a ABAP consumer proxy for this service.
I have done this and it works but the problems started when I tried to generate a second ABAP consumer proxy for a second web service build in MII.
In the ABAP system , transaction SE80 then display proxy class: ( e.g. ZMIICO_XACUTE_WSSOAP )
then go to Properties tab , under sub-screen "External key" you can see the "Name: XacuteWSSoap".
This is the web service port type name generated at MII and is always the same for all the MII web services. When you try to generate a second proxy for a second MII web service you get the following message "A proxy already exists for object XacuteWSSoap (namespace http://www.sap.com/xMII) "
This can be changed by editing the WSDL file but then another problem occurs which is related to the "InputParams" complex type. This tag gets generated with the same name for all the web services in MII. The generation of the ABAP structure with the following name: INPUT_PARAMS will override the previous one . This means that the previous ABAP proxy will not work anymore.
Has any one experimented this ?
Daryoush Delgari.
This is the generated WSDL on MII:
<?xml version="1.0" encoding="UTF-8" ?>
- <definitions targetNamespace="http://www.sap.com/xMII" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.sap.com/xMII" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
- <!-- Types
-->
- <types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">
+ <s:complexType name="InputParams">
- <s:sequence id="InputSequence">
<s:element maxOccurs="1" minOccurs="0" name="FromDate" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="PLANT" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="ToDate" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="XacuteRequest">
- <s:complexType>
- <s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="Rowset">
- <s:sequence>
<s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:Row" />
</s:sequence>
<s:attribute name="Message" type="s:string" />
</s:complexType>
- <s:complexType name="Row">
- <s:sequence id="RowSequence">
<s:element maxOccurs="1" minOccurs="1" name="Day" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="Item" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="Resource" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="WorkCenter" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="ShopOrder" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="OrderQty" type="s:long" />
<s:element maxOccurs="1" minOccurs="1" name="Cured" type="s:long" />
</s:sequence>
</s:complexType>
- <s:element name="XacuteResponse">
- <s:complexType>
+ <s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:Rowset" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
- <!-- Messages
-->
- <message name="XacuteSoapIn">
<part element="s0:XacuteRequest" name="parameters" />
</message>
- <message name="XacuteSoapOut">
<part element="s0:XacuteResponse" name="parameters" />
</message>
- <!-- Ports
-->
- <portType name="XacuteWSSoap">
- <operation name="Xacute">
<input message="s0:XacuteSoapIn" />
<output message="s0:XacuteSoapOut" />
</operation>
</portType>
- <!-- Bindings
-->
- <binding name="XacuteWSSoap" type="s0:XacuteWSSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="Xacute">
<soap:operation soapAction="http://www.sap.com/xMII" style="document" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <!-- Service mapping
-->
- <service name="XacuteWS">
- <port binding="s0:XacuteWSSoap" name="XacuteWSSoap">
<soap:address location="http://<host>:port/XMII/SOAPRunner/Default/Amrik/Wolves/WDPro/getCuresByPeriod" />
</port>
</service>
</definitions>Hi Daryoush,
Little surprise for you, I got the solution ;o)
In fact, editing the WDSL file, you can change the parameter names which will be generated in Web Dynpro. You have to change the tag <complex type ...>.
For example :
<s:complexType name="InputParams">
Could become :
<s:complexType name="*Zs1*InputParams">
and later in the code, you should reference the element appropriately
<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams"/>
should become :
<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:*Zs1*InputParams"/>
But take care to keep name="InputParams", it's the xlm name which will be used by MII to do the matching...
Take care also that you have to do the same for output, that means ROW and ROWSET complex type...
So, to be concrete, here are an example with in bold everything I changed against the original MII WDL file...
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://www.sap.com/xMII" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.sap.com/xMII" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<!-- Types -->
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">
<s:complexType name="*Zs1*InputParams">
<s:sequence id="InputSequence">
<s:element maxOccurs="1" minOccurs="0" name="inputItem" type="s:string"/>
<s:element maxOccurs="1" minOccurs="0" name="inputPlant" type="s:string"/>
<s:element maxOccurs="1" minOccurs="0" name="inputSearchBy" s:long"/>
</s:sequence>
</s:complexType>
<s:element name="XacuteRequest">
<s:complexType>
<s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string"/>
<s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string"/>
<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:*Zs1*InputParams"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="*Zs1*Rowset">
<s:sequence>
<s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:*Zs1*Row"/>
</s:sequence>
<s:attribute name="Message" type="s:string"/>
</s:complexType>
<s:complexType name="*Zs1*Row">
<s:sequence id="RowSequence">
<s:element maxOccurs="1" minOccurs="1" name="Item" type="s:string"/><s:element maxOccurs="1" minOccurs="1" name="ItemDescription" type="s:string"/></s:sequence>
</s:complexType>
<s:element name="XacuteResponse">
<s:complexType>
<s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:*Zs1*Rowset"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<!-- Messages -->
<message name="Xacute*Zs1*In">
<part element="s0:XacuteRequest" name="parameters"/>
</message>
<message name="Xacute*Zs1*Out">
<part element="s0:XacuteResponse" name="parameters"/>
</message>
<!-- Ports -->
<portType name="Xacute*MyTest*">
<operation name="Xacute">
<input message="s0:Xacute*Zs1*In"/>
<output message="s0:Xacute*Zs1*Out"/>
</operation>
</portType>
<!-- Bindings -->
<binding name="Xacute*MyTest*" type="s0:Xacute*MyTest*">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Xacute">
<soap:operation soapAction="http://www.sap.com/xMII" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<!-- Service mapping -->
<service name="XacuteWS">
<port binding="s0:XacuteMyTest" name="XacuteMyTest">
<soap:address location="http://host/XMII/SOAPRunner/Development/WebServices/GetItems/getItemsTrx"/>
</port>
</service>
</definitions>
If you want a demo, you can come to my desk ;o)
Edited by: Olivier Thiry on Mar 12, 2009 1:02 PM
Damned, the bold tag seems not to work... So all my changes are between star (..) -
HOW TO CALL A WEB SERVICE OR EJB FROM BPEL
HI
i want to call java web service or ejb from my bpel process. how can i do this.
i am using oracle soa10.1.3.1.0 and jdeveloper 10.1.3.1.0 and oracle database xe 10g.
thanks in advance K ROYYou could deploy your EJB or Java under a web service into your OC4J, after that, you invoke a partnerlink from BPEL to the destination of wsdl will do. Also don't forget to add in your XSD schema as well.
Thanks,
Jyno -
JCD - making a web service client call from a jcd
Hi,
We would like to make web service client calls from our jcd's in Java CAPS 5.1.2 to an external web services running under a Tomcat 5.5 servlet.
What is the recommended method of calling web services from a jcd?
We attempted to import a WSDL and use the wsdl object but that failed.
One alternative I thought of is generating the client classes from Axis 1.3 and importing an external .jar file with those classes plus the necessary jar to run Axis.
Our external web services are typed as docment/literal, wrapped.
ThanksThe recommended way to make Web Services calls from a Java Collaboration is to use the support for this feature in JCaps 5.1.2. This means using the WSDL as an OTD and linking it to an external web service on the connectivity map.
If you have trouble using the WSDl as an OTD you can open a support case with Sun support (http://goldstar.stc.com/support).
Regards,
Frederik -
Web services call directly from SAP ?
Hi ESA Experts,
Is it possible to make a web service call directly from a SRM or SAP R3 system without using SAP XI ?. If so, have you some code samples ?
Thanks a lot for your response.
Best regards
EtienneHi, Etienne.
There are two things to do.
1. Prepare Service Provider
For providing services, there are many tools to publish as web services
from BAPI, RFC and Enterprise Services.
Please look at here.
help.sap.com - Web Service Toolset
http://help.sap.com/saphelp_nw04s/helpdata/en/db/99c04ba22fe64f96a8651df68eab92/frameset.htm
i recommend Web Service Creation Wizard as first step.
2. Prepare Service Consumer
Also has many tools. What i like is WS Navigator for basic test of web services.
help.sap.com - Web Service Homepage
http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/d7baaf1481a349ab723e3acd7334b3/frameset.htm
Best Regards. -
ORA-28868 error when calling Web service over HTTPS from PL/SQL utl_http
I am getting error message ORA-28868 error when calling Web service over HTTPS from PL/SQL utl_http PL/SQL package,
when browsed through some of the messages they point to setting Oracle Wallet Manager.
I am trying to connect
Any idea on how to resolve this issue ?
your input is appreciated.
Thanks
RaviDuplicate post ... please ignore.
-
When can we publish Air 3.0 from within Flash IDE?
Hi,
I am very eager to get started on developing with Air 3.0.
I'm using Flash CS5.5, but natively Air 3.0 is not available from within the IDE. I know I can publish using the command line, but this is really a bit to complicated for me.
Can anyone tell me if and when we can expect an update for Flash CS5.5 so we can publish Air 3.0 files from within the IDE directly?
Thanx!There are two ways of being able to publish to AIR 3,0 from within Flash CS5.5. You can either rename the AIR2.6 folder and put in the AIR3.9 folder, renamed to AIR2.6. That, of course, won't let you do code completion on new features, or see any interface changes. Or you can follow the long winded overlay process, and then would be able to do code completion.
Are you saying that the long winded overlay way still doesn't give an option to publish with captive runtime? When you said that copying the SDK wouldn't give new UI options, that made me think you were saying that the more elaborate overlay would would.
So, users are then stuck with FB4.6 public beta, command line, or waiting for "Flash Next" before being able to publish captive runtime Android apps. -
Can`t connect to business catalyst from within Dw. How to fix??
Can`t connect to business catalyst from within Dw says there is a server error but internet connection good. Need to publish asap please help !! Was working fine earlier in the day but now refuses. Have tried Muse as well but it can`t reach Bc as well........
Business Catalyst System Status
BC Status
System Updates Forum
Nancy O. -
Can Call Web Service from Applet?
Can we call a .NET Web Service from an Applet?.
Please help me.if the Applet has been downloaded from the same web server where the web service runs, pretty easily. else, you might have to sign the applet.
just build the XML messages .NET is expecting, post them to the server and process the response.
you can try using JAXM but i am not sure the messages it produces will be digested by .NET - just try! -
Calling https web service POST method from ABAP
Hi all,
I'm having some problems trying to call a credit card https web service from ABAP on 2004s SP11. I'm not using a proxy server and a call from a test https page on my local machine works fine. The page does not require a certificate.
Do I need to do anything in particular to make https work ? I've done calls to http services without any problems. The only difference from a programming perspective as far as I know is the scheme 2 instead of 1, and the server protocol changed to HTTPS.
All is fine until I call method http_client->receive, at that point I get a return code of 1, http_communication_failure.
Your suggestions & contributions will be greatly appreciated.
Cheers,
Wouter.
report zcreditcardtest .
data: wf_user type string .
data: wf_password type string .
data: rlength type i,
txlen type string .
data: http_client type ref to if_http_client .
data: wf_string type string .
data: wf_string1 type string .
data: wf_proxy type string ,
wf_port type string .
selection-screen: begin of block a with frame .
parameters: crcard(16) type c lower case default '4242424242424242',
cvn(4) type c lower case default '564',
year(2) type c lower case default '07',
month(2) type c lower case default '11',
amount(10) type c lower case default '100.00',
cukey(4) type c lower case default 'AUD',
order(10) type c lower case default 'AB1322-refund'.
selection-screen skip 1.
parameters: user(50) lower case,
password(50) lower case ,
p_proxy(100) lower case default '' ,
p_port(4) default ''.
selection-screen: end of block a .
at selection-screen output.
loop at screen.
if screen-name = 'PASSWORD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
start-of-selection .
clear wf_string .
concatenate
'order.type=capture&customer.username=SOMEUSER'
'&customer.password=SOMEPASSWORD'
'&customer.merchant=SOMEMERCHANT'
'&card.PAN=' crcard
'&card.CVN=' cvn
'&card.expiryYear=' year
'&card.expiryMonth=' month
'&order.amount=' amount
'&customer.orderNumber=' order
'&card.currency=' cukey
'&order.ECI=IVR'
'&customer.captureOrderNumber=' order
'&order.priority=1'
'&message.end=null'
into wf_string .
break-point.
clear :rlength , txlen .
rlength = strlen( wf_string ) .
move: rlength to txlen .
clear: wf_proxy, wf_port .
move: p_proxy to wf_proxy ,
p_port to wf_port .
call method cl_http_client=>create
exporting
host = 'api.somewhere.com'
service = '80'
scheme = '2' "https
proxy_host = wf_proxy
proxy_service = wf_port
importing
client = http_client.
http_client->propertytype_logon_popup = http_client->co_disabled.
wf_user = user .
wf_password = password .
* proxy server authentication
call method http_client->authenticate
exporting
proxy_authentication = 'X'
username = wf_user
password = wf_password.
call method http_client->request->set_header_field
exporting
name = '~request_method'
value = 'POST'.
call method http_client->request->set_header_field
exporting
name = '~server_protocol'
value = 'HTTPS/1.0'.
call method http_client->request->set_header_field
exporting
name = '~request_uri'
value = '/post/CreditCardAPIReceiver'.
call method http_client->request->set_header_field
exporting
name = 'Content-Type'
value = 'application/x-www-form-urlencoded; charset=UTF-8'.
call method http_client->request->set_header_field
exporting
name = 'Content-Length'
value = txlen.
call method http_client->request->set_header_field
exporting
name = 'HOST'
value = 'api.somewhere.com:80'.
call method http_client->request->set_cdata
exporting
data = wf_string
offset = 0
length = rlength.
call method http_client->send
exceptions
http_communication_failure = 1
http_invalid_state = 2.
call method http_client->receive
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
if sy-subrc <> 0.
message e000(oo) with 'Processing failed !'.
endif.
clear wf_string1 .
wf_string1 = http_client->response->get_cdata( ).
* Further Processing of returned values would go here.Well, finally got this running !
First of all I needed to download SAP Cryptographic Software and install it on the Web Application Server. Added some parameters to the profile, then set up some nodes in strust. Note 510007 describes the full process.
I then installed the certifcate I needed by opening the website in internet explorer and exporting it to a CER file and then importing it into the SSL client (Anonymous). The blog from Thomas Yung, "BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP" describes the process of exporting and importing certificates.
I then had to start the HTTPS service on my NW 2004s ABAP preview edition SP11. I set this up for port 443.
/osmicm --> GOTO --> SERVICES --> SERVICE --> CREATE
Then finally, the program needed a few changes :
call method cl_http_client=>create
exporting
host = 'api.somewhere.com'
service = '443' " <<----- 443 NOT 80
scheme = '2' "https
ssl_id = 'ANONYM' " <<----- SSL_ID Added
proxy_host = wf_proxy
proxy_service = wf_port
importing
client = http_client.
and further in the program (thanks Andrew !) :
call method http_client->request->set_header_field
exporting
* name = '~server_protocol' " <<<--- DELETE
name = '~request_protocol' " <<<-- INSERT must be request
value = 'HTTPS/1.0'.
and presto, we can now consume a https webservice via a POST method from within an ABAP program ! Nice.... Can I give myself 10 points ? -
Cosuming web service using consumer proxy - not getting the output
Hello All,
I am not getting the consumer proxy output structue filled though the web service is successfully executed. I did the following steps.
1. Created a webservice form RFC BAPISDORDER_GETDETAILEDLIST
2. Created a consumer proxy for the above created WSDL document.
3. Tested the service by executing the proxy directly by feeding the input in the XML (sales document and partner view). it is working fine
4. Created a program to access the consumer proxy by passing the input(same input as per XML). I am not getting the output in the proxy output structure ( but I can see the RFC is successfully executed and having the right values in the debugging mode).
Is this the issue is due to the date fields (XML cannot consider a blank date )?
Please note: the partner output table parameter in the bapi (output I am looking for ) is not having any date fields.
Please help me to sort out this issue.
Thanks,
GopiHi Gopi,
From your description, I assume you used the SE37 transaction's menu option Utilities -> More Utilities -> Create Web Service -> From the Function Module, to expose the BAPI concerned as a Web Service.
If this is the case, then it is possible that you are falling foul of your SAP User ID not having the necessary Remote Function Call authorization to execute the BAPI.
A prerequisite for successfully calling an RFC-enabled Function Module (which is what a BAPI is) is that the User ID used to call the function module must have the required RFC authorization (Authorization Object S_RFC). For example, when calling function module BAPI_CUSTOMER_GET_ROOT, if the User ID lacks the requisite authorization in the target system, the following error message will be received by the Consuming application:
User <User ID> has no RFC authorization for function group V02HBAPI.
Notice, as you can see from the above message, RFC execution authorization is implemented at the Function Group level, not at the Function Module level. In othere words, granting a user the authorization to a function group (authorization object S_RFC) enables the user to execute all RFC-enabled function modules contained within that function group.
I am guessing the BAPI works for you in debug mode because you are not calling the BAPI remotely.
Let me know if this helps.
Best Regards,
Andy. -
Generating Ruby Web Service Access Classes from a WSDL
If you have tried to consume a web service from Ruby you surely have noticed how annoying is to write manually all the Ruby code just to invoke a service with complext input parameters' structure:
- You have to know what do the input parameters, their structure and type look like;
- You have to write Ruby classes for them to encapsulate the structures;
- You have to instantiate these classes and pass the objects to the web service proxy class;
- You have to interprete the output parameters.
All this is not impossible of course, but if you are just consumer of the web service and not the developer, if you don't have the exact documentation, you have to read the WSDL description of the service and create the Ruby classes (structures) for the parameters.
Fortunately there is a small, though handy tool, called <b>wsdl2ruby.rb</b>. It accomplishes all these boring tasks for you.
In the following example I will try to show you how <b>wsdl2ruby</b> can be used to generate Ruby classes for accessing a SAP NetWeaver web service, called <b>CreditChecker1</b> (a web service for checking if a person is reliable credit consumer).
To generate the necessary classes we will create a ruby script. Let us name it <b>ws2rgen.rb</b>. Here is what this file looks like:
# Import the wsdl2ruby library.
require 'wsdl/soap/wsdl2ruby'
require 'logger'
# Callback function for the WSDL 2 Ruby generation options.
def getWsdlOpt(s)
optcmd= {}
s << "Service"
optcmd['classdef'] = s
#should work but doesn't, driver name is derived from classname
#if you specify both it breaks, same thing for client_skelton
#optcmd['driver'] = s
optcmd['driver'] = nil
#optcmd['client_skelton'] = nil
optcmd['force'] = true
return optcmd
end
# Create logger.
logger = Logger.new(STDERR)
# Create WSDL2Ruby object and generate.
worker = WSDL::SOAP::WSDL2Ruby.new
worker.logger = logger
# WSDL file location.
worker.location = "http://mysapserver:53000/CreditChecker1/Config1?wsdl"
# Where to generate.
worker.basedir = "temp"
# Set options.
worker.opt.update(getWsdlOpt("Service"))
# Heat.
worker.run
The procedure is straightforward. First we create the WSDL2Ruby object, set its properties <b>location</b> and <b>basedir</b> and then set all other options via the callback function <b>getWsdlOpt()</b>. For further information about these parameters one could consult the source code of wsdl2ruby or contact the developers. Nevertheless the default options are pretty satisfactory. With the last line we start the generation. Two Ruby files will be generated in the <b>temp</b> folder, which is a subfolder of the script's current folder. <b>Please, create the folder "temp" before executing the script.</b>
This generates two files. The first one is <b>CreditChecker1Wsd.rb</b>, containing the necessary data structures:
require 'xsd/qname'
# {urn:CreditChecker1Vi}areReliable
class AreReliable
@@schema_type = "areReliable"
@@schema_ns = "urn:CreditChecker1Vi"
@@schema_qualified = "true"
@@schema_element = [["persons", "ArrayOfPerson"]]
attr_accessor :persons
def initialize(persons = nil)
@persons = persons
end
end
# {urn:CreditChecker1Vi}areReliableResponse
class AreReliableResponse
@@schema_type = "areReliableResponse"
@@schema_ns = "urn:CreditChecker1Vi"
@@schema_qualified = "true"
@@schema_element = [["response", ["ArrayOfboolean", XSD::QName.new("urn:CreditChecker1Vi", "Response")]]]
def Response
@response
end
def Response=(value)
@response = value
end
def initialize(response = nil)
@response = response
end
end
# {urn:CreditChecker1Vi}isReliable
class IsReliable
@@schema_type = "isReliable"
@@schema_ns = "urn:CreditChecker1Vi"
@@schema_qualified = "true"
@@schema_element = [["person", "Person"]]
attr_accessor :person
def initialize(person = nil)
@person = person
end
end
# {urn:CreditChecker1Vi}isReliableResponse
class IsReliableResponse
@@schema_type = "isReliableResponse"
@@schema_ns = "urn:CreditChecker1Vi"
@@schema_qualified = "true"
@@schema_element = [["response", ["SOAP::SOAPBoolean", XSD::QName.new("urn:CreditChecker1Vi", "Response")]]]
def Response
@response
end
def Response=(value)
@response = value
end
def initialize(response = nil)
@response = response
end
end
# {urn:java/lang}ArrayOfboolean
class ArrayOfboolean < ::Array
@@schema_type = "boolean"
@@schema_ns = "http://www.w3.org/2001/XMLSchema"
@@schema_element = [["boolean", ["SOAP::SOAPBoolean[]", XSD::QName.new("urn:java/lang", "boolean")]]]
end
# {urn:com.sap.scripting.test.services.creditchecker.classes}Person
class Person
@@schema_type = "Person"
@@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
@@schema_element = [["age", "SOAP::SOAPInt"], ["name", "SOAP::SOAPString"], ["purse", "Purse"]]
attr_accessor :age
attr_accessor :name
attr_accessor :purse
def initialize(age = nil, name = nil, purse = nil)
@age = age
@name = name
@purse = purse
end
end
# {urn:com.sap.scripting.test.services.creditchecker.classes}Purse
class Purse
@@schema_type = "Purse"
@@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
@@schema_element = [["color", "SOAP::SOAPString"], ["money", "Money"]]
attr_accessor :color
attr_accessor :money
def initialize(color = nil, money = nil)
@color = color
@money = money
end
end
# {urn:com.sap.scripting.test.services.creditchecker.classes}Money
class Money
@@schema_type = "Money"
@@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
@@schema_element = [["amount", "SOAP::SOAPDouble"], ["currency", "SOAP::SOAPString"]]
attr_accessor :amount
attr_accessor :currency
def initialize(amount = nil, currency = nil)
@amount = amount
@currency = currency
end
end
# {urn:com.sap.scripting.test.services.creditchecker.classes}ArrayOfPerson
class ArrayOfPerson < ::Array
@@schema_type = "Person"
@@schema_ns = "urn:com.sap.scripting.test.services.creditchecker.classes"
@@schema_element = [["Person", ["Person[]", XSD::QName.new("urn:com.sap.scripting.test.services.creditchecker.classes", "Person")]]]
end
The second file is <b>CreditChecker1WsdDriver.rb</b>. In it you can find a generated child class of SOAP::RPC::Driver, containing all methods of this web service, so you don't need to add every method and its parameters to call the web service.
require 'CreditChecker1Wsd.rb'
require 'soap/rpc/driver'
class CreditChecker1Vi_Document < ::SOAP::RPC::Driver
DefaultEndpointUrl = "http://mysapserver:53000/CreditChecker1/Config1?style=document"
MappingRegistry = ::SOAP::Mapping::Registry.new
Methods = [
def initialize(endpoint_url = nil)
endpoint_url ||= DefaultEndpointUrl
super(endpoint_url, nil)
self.mapping_registry = MappingRegistry
init_methods
end
private
def init_methods
Methods.each do |definitions|
opt = definitions.last
if opt[:request_style] == :document
add_document_operation(*definitions)
else
add_rpc_operation(*definitions)
qname = definitions[0]
name = definitions[2]
if qname.name != name and qname.name.capitalize == name.capitalize
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
__send__(name, *arg)
end
end
end
end
end
end
There is a problem with this script, since the <b>Methods</b> array is empty. I suppose it is due to the imports in the SAP NetWeaver WSDL, maybe wsdl2ruby is not mighty enough to handle these WSDL imports. When I succeed in overcoming this, I will post again in this thread to let everybody know.
Message was edited by: Vasil BachvarovHi,
I find Ruby to be really tough to consume SAP WebServices. For simple scenarios like currency conversion may it is good. But for complex scenarios such as Purchase Order entry etc..I found it very annoying to use wsdl2ruby and see that it didnt generate correct proxies.
Until wsdl2ruby is stable enough to support complex datatypes, authentication etc. my recommendation is to use JRuby and use Java Proxies generated by NW Developer studio until pure Ruby's web service support improves.
Following link might be of interest w.r.t wsdl2ruby
http://derklammeraffe.blogspot.com/2006/08/working-with-wsdl2r-soap4r-and-complex.html
Regards
Kiran -
How can I execute an external program from within a button's event handler?
I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
So, then, how can I do this?
Thanks
Ted
NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
try {
java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
//pn.directory(new java.io.File("K:\\work"));
java.lang.Process pr = pn.start();
java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
String tmp = new String("");
byte b[] = new byte[1000];
int i = 0;
while (i != -1) {
bis.read(b);
tmp += new String(b);
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
} catch (java.io.IOException ex) {
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
}Hi Fonsi!
One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
/Thomas -
Web Service returning data from 2 proxies
Hi Guys,
Can someone help me with the design here.. We're using XI 7.1 and I'm still struggling with my Sync soap sender to proxy interface.
I've got my basic soap sender to proxy which returns a structure from the proxy sending it back to the web service as a response.
like so: [Screen Print|http://www.photostand.co.za/images/orvgugyciny7x1nu4oua.png]
But now I need to include another proxy to get other data and send that back in this response show above. Can I have 2 sync target operations sending back a response to the same source operation?
Thanks,
JanWhat is your Traget System?
If ABAP proxy--Follow beloa appraoch
option 1: develop two sync interfaces
Option 2: Develop Receiver response proxy structure and this structure should hold two proxy responses and write proxy logic to send response in one shot.
in this case one interface enough.
Regards,
Raj
Maybe you are looking for
-
IPhone 5s cuts out blue screen appears then Gos Dead
fone cuts out on me when making calls or on Internet then Gos to a blue screen then the White screen with Apple logo then shuts down and will not come back on t
-
My iMac G5 w/isight display stays black on start up
This all started yesterday when I put my computer to sleep and came back to wake it up. While away my computer actually turned off and when I hit space to wake it it rebooted with no display. When I try to start it up it makes the start up noise, fan
-
Hello. I've seen this issue in a few other forums, but no methods have gotten me to my final target of being able to edit HuffYUV video (1080 24p) in Premiere or After Effects. I tried huffyuv-1.3.1, huffyuv-2.1.1, and huffyuv64. I have read that the
-
Unable to install flash installer
My memory is a little fuzzy on the series of events but I'm pretty sure this is what happened: Flash was working fine last week. Got a notification that I could update Flash so I did. Got an error during installation (was probably this one but can't
-
Unable to connect to any email server - old MBP, 10.7.5
I am dusting off my old MB Pro to use as an email SPAM filtering drone using Spamseive. However, I cannot get the Mail program to connect to any mail servers, iCloud, other IMAP or POP. I get the same problem for all of them, saying "The IMAP (or POP