Consuming Web Service Without Proxy
Hi, it is possible to consume a web service in JSP page without using any proxy (deployable or standalone)?
Thanks.
Thanks for the response. Although not sure that is necessarily the 'correct' way ("Or,
enter a PSCredential object, such as one generated by the Get-Credential cmdlet.")
but it had no effect either way. I get the same error.
Similar Messages
-
How to consume web service without any middleware from abap RFC
Hi Experts,
I have a RFC and i need to send the data to a web service.
So, I came to know that i need to create a proy for that.
While creating proxy what shd i choose,
URL or
http or Local file
or Enterprose service repositort
please give some steps.
Thnak You.Hi,
You need to download the WSDL file on your local desktop and choose the Local file option.
Regards,
Vikas -
Consume web service in ABAP proxy with SOAP header
Hi Thomas ,
I am trying to consume web service in ABAP . I have followed the procedure from one of your web blog <a href="/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap a Developer's Journal Part XIV - Consuming WebServices with ABAP</a> . (640 release).
I need to pass SOAP header along with SOAP body. As you mentioned I have used if_wsprotocol_ws_header interface to pass header but it is still failing.
Please see below code and please give some direction to fix the issue.
1.Create ABAP proxy for WSDL (http://ws.strikeiron.com/SwanandMokashi/StockQuotes?WSDL). It has created structures only for SOAP body.
2.Create Logical port
3.Create following program to call proxy
REPORT zproxy.
DATA: ref_stock TYPE REF TO zzco_stock_quotes_soap ,
ws_header TYPE REF TO if_wsprotocol_ws_header,
name TYPE string,
namespace TYPE string.
TRY.
CREATE OBJECT ref_stock
get WS_HEADER protocol
ws_header ?= ref_stock->get_protocol('IF_WSPROTOCOL_WS_HEADER').
set somehow header as iXML-DOM tree
DATA: ixml TYPE REF TO if_ixml,
xml_document TYPE REF TO if_ixml_document,
xml_root TYPE REF TO if_ixml_element,
xml_element TYPE REF TO if_ixml_element,
xml_node TYPE REF TO if_ixml_node.
DATA l_xstring TYPE xstring.
DATA l_string TYPE string.
FIELD-SYMBOLS <fs_xstring> TYPE xstring.
Additional Header:
CONCATENATE
'<soap:Header>'
'<s1:LicenseInfo xmlns:s1="http://ws.strikeiron.com">'
'<s1:RegisteredUser>'
'<s1:UserID>[email protected]</s1:UserID>'
'<s1:Password>aaaaaaaa</s1:Password>'
'</s1:RegisteredUser></s1:LicenseInfo>'
'</soap:Header>' INTO l_string.
convert to xstring
l_xstring = cl_proxy_service=>cstring2xstring( l_string ).
IF NOT l_string IS INITIAL.
create iXML DOM document from XML xstring
CALL FUNCTION 'SDIXML_XML_TO_DOM'
EXPORTING
xml = l_xstring
IMPORTING
document = xml_document
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
IF sy-subrc = 0 AND NOT xml_document IS INITIAL.
xml_root = xml_document->get_root_element( ).
xml_element ?= xml_root->get_first_child( ).
add header element by element to SOAP header
WHILE NOT xml_element IS INITIAL.
name = xml_element->get_name( ).
namespace = 'http://swanandmokashi.com' . "xml_element->get_namespace_uri( ).
IF NOT xml_element IS INITIAL.
ENDIF.
ws_header->set_request_header(
name = name
namespace = namespace
dom = xml_element ).
xml_element ?= xml_element->get_next( ).
ENDWHILE.
ENDIF.
ENDIF.
CATCH cx_ai_system_fault .
ENDTRY.
*Call soap body using abap proxy class.
DATA: get_quotes TYPE zzget_quotes_soap_out .
DATA: get_quotes1 TYPE zzget_quotes_soap_in .
get_quotes1-quote_ticker = 'GE'.
TRY.
CALL METHOD ref_stock->get_stock_quotes
EXPORTING
get_quotes1 = get_quotes1
IMPORTING
get_quotes = get_quotes.
CATCH cx_ai_system_fault .
CATCH cx_ai_application_fault .
ENDTRY.
4.It is throwing cx_ai_system_fault error.
SOAP details:
Input:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding" >
<soap:Header>
<s1:LicenseInfo xmlns:s1="http://ws.strikeiron.com">
<s1:RegisteredUser>
<s1:UserID>[email protected]</s1:UserID>
<s1:Password>aaaaaaaa</s1:Password>
</s1:RegisteredUser>
</s1:LicenseInfo>
</soap:Header>
<soap:Body>
<tns:GetQuotes xmlns:tns="http://swanandmokashi.com">
<tns:QuoteTicker>GE</tns:QuoteTicker>
</tns:GetQuotes>
</soap:Body>
</soap:Envelope>
Thanks,
Kavitha.Hi ,
Thank you for the response. Did you passed user email and password ([email protected] /aaaaaaaa) part of licenseinfo->resisteredUser along with Quoteticker GE in analyzer?
<a href="http://www.strikeiron.com/Analyzer/OnlineAnalyzer.aspx?WSDL=http://ws.strikeiron.com/SwanandMokashi/StockQuotes?WSDL">ANALYZER</a>
Thanks,
Kavitha. -
Pros & Cons for consuming web services in ABAP using ABAP PROXY
Hi,
Other then performence is there any other disadvantages like security,etc for consuming web services in ABAP using ABAP proxy?
I really appreciate if some one provide the more details(Pros & Cons ) regarding cosuming web services and I also want to know is there any other way to consume web services in ABAP.
Thanks.<i> is there any other way to consume web services in ABAP</i>
you can use cl_http_client class to make your program to act as http client and post the soap message too webservice. This way you dont need to generate proxy, but you should know the soap message format.
Regards
Raja -
Consuming Web Service - Proxy Generation Terminated
Hello all,
I have recently been exploring the capabilities of consuming Web Services from ABAP and have run into some issues.
When I generate the Client Proxy from different WSDL files, I am frequently getting these two errors:
<i>Proxy generation terminated: "mixed content" not supported</i>
<i>Proxy generation terminated: WSDL error (<extension> not supported)</i>
Is this just a limitation of ABAP? If I get these errors, is there any way to use the Web Service?
Thanks in advance!Hi, had the same issue. try to rename the file to .xml ending.
HTH; rgds, marco -
Consuming web service in portal
Hi all,
I had a web service now i want to use it in my portal.
Can anyone help me in this regard.Hi Lokesh,
To consume a Web service, you can create a deployable or a standalone proxy for the Web service in the SAP NetWeaver Developer Studio using a WSDL document as a basis. This can be done with just a few mouse clicks.
The difference between a deployable and a standalone proxy is that, for a deployable proxy, the application of the Web service client must be deployed on the J2EE engine. A standalone proxy can be executed without the J2EE engine.
The role of the Web service client developer has been created so that Web services can be consumed.
The Web service client developer has the task of integrating a Web service in an application. He or she knows the specific requirements for the Web service and creates the Web service client proxy definition. Afterwards, the developer programs the client application using the service endpoint interface.
Please read through this Step by Step approach for same:-
[Consume WebServices in Portal|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c2188ae5-0601-0010-dd93-c23e381ef41e]
Hope this helps,
Regards,
Shailesh -
Consuming Web Service In Visual Studio
Hi there:
I'm using the sneak preview of SAP NetWeaver 2004s ABAP Server and am able to consume in Visual Studio 2005 (C#) all the 'delivered' Web Services without any problems. However, when I create a Web Service through SE37 or SE80 (Wizard WS_WZD_START) using a BAPI or Remote enabled RFC (ie RFC_READ_TABLE) I am getting a error when I try to call it in Visual Studio. In Visual Studio, I am able to add the reference (http://localhost:8000/sap/bc/srt/rfc/sap/ZRFC_READ_TABLE?WSDL) no problem. When I call it though, I get {"Unable to connect to the remote server"}, with inner exception {"No connection could be made because the target machine actively refused it"}.
I am providing the credentials (username and password) in the code which are the same as when I go to retrieve the reference.
Any help would be greatly appreciated.
Thanks
RussHi Russ,
I had similar problems. You should download the WSDL file to the local file system. Then you can add the downloaded WSDL file as a Web reference rather than using a URL.
Please note the following issue:
You have to provide the full qualified path <b>including</b> the file name in the text box for the URL and then press Go.
For example:
<i>
C:\Documents and Settings\USERID\My Documents\downloads\SAP\WebServices
Z_BAPI_CUSTOMER_FIND_VI.wsdl
</i>
If you just provide the path and try to select the WSDL file this probably does not work. At least it was not working for me.
Best regards,
Andre -
Best practice for consuming web services
Hi
we are consuming web service in orchestration by "Add Generated Item".By using this option it creates 1 orch,1xsd file and some bindings.
we have different projects for schemas,maps and orchestration under our solution in visual studio.
Now i need to know that what will be the best practice for consuming web service in orchestration i mean in which project should i use "add generated item" (in orchstration project or in schemas project) coz it generates both 1 orch and 1
schema.
thanksFrom a service orientation perspective you should abstract the service artifacts from the other artifacts. Otherwise it will be very difficult to update the service interface without affecting the other artifacts. For example you don't want to have to redeply
your entire application if only one field changes in the service you consume.
So I typically generate the items, remove the unnecessary stuff, and put them in a separate project.
Depending on the control you have over the services you want to consume, it would even be better to create another layer of abstraction. By that I mean create your own interface (schema) and map that one to the one the service exposes. This basically
is only necessary if you consume external services that are beyond your control. By abstracting the interface it exposes, you limit the impact of changes of that interface on the rest of your system. All changes are abstracted behind your own interface.
If you consume internal services, you can probably control the way the interface is defined. In a service oriented world all internal services expose a well known interface, based on the domain objects you have within your organisation.
Jean-Paul Smit | Didago IT Consultancy
Blog |
Twitter | LinkedIn
MCTS BizTalk 2006/2010 + Certified SOA Architect
Please indicate "Mark as Answer" if this post has answered the question. -
Windows authentification while consuming web service from ABAP
Hi All,
We are consuming web service from ABAP, we have created client proxy in SE80 and configured logical port in LPCONFIG.
This one was working fine. Now we have added windows user authentification to access this service.
Now when I'm trying to regenerate this proxy in R/3 it is asking for user and password. When I enter these details this one is not working.
If I access this service direcly from internet explorer and I enter same user and password then I would able to access this service.
Could you please let me know how to handle this.
Regards
VikramThe dialog that is produced by HTTP Destination object of the logical port is designed only for use within Classic Dynpro applications. There is no prompt produced when running in Web Dynpro. If possible assign a generic user within the logical port definition and this will be used automatically by all users.
-
Consuming Web Services with ABAP - WSDL
Hi All,
I Want to consume web service in abap, i found lot of documents,Here i am having data in the internal table i need to pass
it to wsdl file, The Web Service or Proxy generates a WSDL file. So this WSDL file can be consumed on ABAP Front and Encrypt the Data that is to be sent to the Banks.
I found the input and output, Where i can find the method generated or we need to create it
CALL METHOD io_clientproxy->XXXXXXXXXXXX
please let me have your valuable ideas
Thanks in advance,
Arun.Hi Miguel,
I have not heared about SPROXY, Here i found some code,which calls a web service method and where it is from.
when i double click on my proxy it shows me some method.IF_PROXY_BASIS_INTERNAL~CREATE_FRAMEWORK
this is the one web service method. and i meed to pass the internal table data to WSDL file.
*-- create web service proxy class instance
TRY.
CREATE OBJECT io_clientproxy
EXPORTING
logical_port_name = 'LP4'.
CATCH cx_ai_system_fault.
ENDTRY.
*-- call web service methods
TRY.
CALL METHOD io_clientproxy->get_airport_information_by_is
EXPORTING
input = input
IMPORTING
output = output.
CATCH cx_ai_system_fault.
CATCH cx_ai_application_fault.
ENDTRY.
*-- text processing
output_string = output-get_airport_information_by_is.
REPLACE ALL OCCURRENCES OF
'<' IN output_string WITH '<' .
REPLACE ALL OCCURRENCES OF
'>' IN output_string WITH '>' .
REPLACE ALL OCCURRENCES OF
'xmlns=' IN output_string WITH 'xmlns:xsl=' .
*-- parsing
TRY .
CALL TRANSFORMATION ('Y_AIRPORT_XML2ABAP')
SOURCE XML output_string
RESULT outtab = outtab.
CATCH cx_xslt_exception INTO xslt_err.
DATA: s TYPE string.
s = xslt_err->get_text( ).
WRITE: ': ', s.
STOP.
ENDTRY .
Regards,
Arun. -
Code for consuming web services in ABAP
*& Report ZVM_GET_CITY_TIME
REPORT zvm_get_city_time.
PARAMETERS:
p_city TYPE zget_city_time_soap_in-city.
DATA:
cl_proxy TYPE REF TO zco_time_service_soap,
input TYPE zget_city_time_soap_in,
output TYPE zget_city_time_soap_out,
systerr TYPE REF TO cx_ai_system_fault,
w_error TYPE c.
TRY.
CREATE OBJECT cl_proxy
EXPORTING
logical_port_name = 'ZCO_TIME_SERVICE_SOAP'.
CATCH cx_ai_system_fault.
CREATE OBJECT systerr.
WRITE:/ 'Error in creating object - ', systerr->errortext.
ENDTRY.
TRY.
input-city = p_city.
CALL METHOD cl_proxy->get_city_time
EXPORTING
input = input
IMPORTING
output = output.
CATCH cx_ai_system_fault.
CREATE OBJECT systerr.
WRITE:/ 'Error in calling the method - ', systerr->errortext.
w_error = 'X'.
ENDTRY.
CHECK w_error NE 'X'.
SKIP.
WRITE:/ 'The current time in ', p_city, ' is ',
output-get_city_time_result.<i> is there any other way to consume web services in ABAP</i>
you can use cl_http_client class to make your program to act as http client and post the soap message too webservice. This way you dont need to generate proxy, but you should know the soap message format.
Regards
Raja -
Biztalk 2010 - Consume Web Service with Certificate
Hi
I have to consume a java web service with Biztalk that requires authentication via a client certificate. Until now I have not been able to consume any web service where any kind of authentication was needed. Simple web services without authentication are
no problem. Also using SoapUI works perfectly fine.
I am generating the XSDs and the port binding with the WCF wizard in VS2010. I've read several comments that it's not possible to consume web services with the WCF-WSHttp adapter when the message format should be SOAP 1.1. Therefore I'm trying with the WCF-BasicHttp
and WCF-Custom adapters, but I did not suceed in receiving a positive response yet.
The web service I want to consume uses a client certificate (with a private key) and two root certificates. When I use the BasicHttp adapter I choose either 'Transport' or 'TransportWithMessageCredential' but none of them work. I also have to supply a client
and a service certificate. I always use the one with the private key for the client but I'm not sure which one I have to use for the service. Is there a possibility that I have to provide both root certificates and if so, how can I achieve this?
Hope the question makes sense somehow... thanks for any input.
Error message that I receive currently is that the server needs a client certificate. However I attached it in the send port properties under the tab "Security" => mode "TransportWithMessageCredential".Adapter: WCF-Custom
Binding: customBinding
Cannot send pictures (yet).
<configuration>
<enterpriseLibrary.ConfigurationSource selectedSource="ESB File Configuration Source" />
<system.serviceModel>
<client>
<endpoint address="...." behaviorConfiguration="EndpointBehavior" binding="customBinding" bindingConfiguration="ReceiptBinding" contract="BizTalk" name="WebServicePort" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="EndpointBehavior">
<clientCredentials>
<clientCertificate findValue="..." x509FindType="FindByThumbprint" />
<serviceCertificate>
<defaultCertificate findValue="..." storeLocation="LocalMachine" storeName="AuthRoot" x509FindType="FindByThumbprint" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior" />
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<clear />
<binding name="ReceiptBinding">
<textMessageEncoding messageVersion="Soap11" />
<security authenticationMode="MutualCertificate" />
<httpsTransport proxyAuthenticationScheme="Basic" requireClientCertificate="true" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
</configuration> -
How to consume Web Services form ABAP ?
Hi,
Please advise how to consume web services from ABAP Code ? is there any automatic generating proxy class in order to consume web services ?
I am using NW 7.0 SP15
Thank You and Best Regards
Fernand LesmanaHi Fernand,
chk out for this link
Consume an ABAP Webservice (WAS 620) from .Net
Send SMS to India from ABAP
working web service from ABAP
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a4433436-0301-0010-f2a9-9281ad574054
Regards
Sampath -
How to consume WEB SERVICES from ABAP ??
Q: How to consume WEB SERVICES from ABAP program??
the point here is i am using SAP release 620 and the creation of proxy is out of scenario
and also no XI. Its only through ABAP program i need to consume one web service (its a HTTPS one ),
Using cl_http_client... i tried it but i am totally confused of whats happening ???
Req some senior ppl advice on the same/approach.
any hints will suffice my way of approach...!!!
Please do put in your valuable advices..!!
Thanks in advance..!!!!Hello Srinivas,
Following is the code for calling web service:
data: client type ref to if_http_client,
host type string value 'server url',
service type string value '8080',
path type string value '/sap/public/ping',
errortext type string,
proxy_service type string,
scheme type i value 1.
call method cl_http_client=>create
exporting host = host
service = service
proxy_host = host
proxy_service = service
scheme = scheme
importing client = client
exceptions
argument_not_found = 1
internal_error = 2
plugin_not_active = 3
others = 4.
case sy-subrc.
when 0.
write 'Server reached successfully'.
when others.
write: 'sy-subrc =', sy-subrc.
endcase.
Once you got the client object you can call following methods:
"Set the requrie URL for the web service you want to call. This is not WSDL anyway!!
cl_http_utility=>set_request_uri( request = client->request
uri =' url 2 be called ').
*Then you can call send method with proper inputs for sending request to WS
CALL METHOD client->send
Then you can use receive method for getting the response
CALL METHOD client->receive
*You can get last error in case of exceptions
CALL METHOD cl_http_client=>get_last_error
*Close the client object
CALL METHOD client->close
For more information on full code refer my link in previous replay.
Thanks,
Augustin.
Edited by: Augustarian on Aug 18, 2009 1:49 PM -
HI
I am consuming web service WSDL file in ABAP using client proxy concept. But every time i execute the program system is
asking for portal user name and pwd. where can i put user name an pwd so that system can take it directly from there
during run time.
Regards,
Shyam.Yes,
There is a place in SOAMANAGER to put userid and pwd for portal user. and this works.
Thanks,
Shyam
Maybe you are looking for
-
Print to LaserJet 3150 Shared by Windows XP Pro
I have an older, but servicable LaserJet 3150 hooked to my Windows XP Pro desktop at work. A long time ago, I set it up to share with OS X by creatign a virtual printer using GhostScript and some other queuing utility - this made is look like a PostS
-
I am unable to sync the movies from my camera onto my ipad, via my PC. A message keeps telling me the ipad won't play the movies because they are in the wrong format. Can someone help please? Cheers, Pete
-
Is there jelly bean avaliable for sony xperia u
Hello Hi I'm using sony experia u ics rooted plz let me know is than an official software of jellybean for it or is there any un official s/w of it i want to upgrade from ics to JB more over if JB is developing for it how much time will take to come
-
CLM Importing Master Agreement: Is it possible to import custom collection
Hello, We are looking to migrate some legacy data into CLM using the import master agreement (setup->Import and Export Tools). This approach works fine for all standard data as well as extensions that are single entry fields (not collections). We w
-
IPad Air stuck in recovery mode!
Tried to update my iPad Air to iOS 8 this afternoon. Plugged into my brand new Macbook Air (about one month old), backed up to iTunes. Clicked to begin the update and install, left the room. Came back to find the iPad Air in recovery mode (iTunes log