Problem consuming web service created by ABAP via standalone java client
I'm trying to consume web service created by ABAP in R3 system via standalone java client. I should be getting a string reply after consumed the web service (ZSMS_INBOUND), but so far i received null. I cant find any exception or log to trace the problem. Any help would be appreciated. Is there anything wrong with my client calling the web service?
public void myMethod{
// TODO : Implement
try{
Stub stub = (Stub)new ZSMS_INBOUNDServiceImpl().getLogicalPort();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,"http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap- client=100&wsdl=1.1&mode=sap_wsdl");
inboundService = (ZSMS_INBOUND) stub;
BAPIRET2 str = inboundService.ZSMS_INBOUND(date, message, modemId, smsId, tel, time);
ackDeliveryArray<i> = str.toString();
}catch (Exception e) {
e.printStackTrace();
Generated following SAP help standalone proxy creation steps.
***files fr SEIs
ZSMS_INBOUND.java (interface)
ZSMS_INBOUNDService.java (interface)
ZSMS_INBOUNDServiceImpl.java
ZSMS_INBOUNDSoapBindingStub.java
***files fr Proxy classes
ZSMS_INBOUND.java
ZSMS_INBOUNDResponse.java
BAPIRET2.java
.... many more files
the wsdl is as below (generated by ABAP):
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:n0="http://www.sap.com/webas/630/soap/features/authentication/" xmlns:sap="http://www.sap.com/webas/630/wsdl/features" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">
- <xsd:simpleType name="char1">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char10">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char17">
+ <xsd:restriction base="xsd:string">
<xsd:maxLength value="17" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char170">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="170" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char20">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="20" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char220">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="220" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char30">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="30" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char32">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char50">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="date">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
<xsd:pattern value="\d\d\d\d-\d\d-\d\d" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="numeric3">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="3" />
<xsd:pattern value="\d*" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="numeric6">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="6" />
<xsd:pattern value="\d*" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="time">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
<xsd:pattern value="\d\d:\d\d:\d\d" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:complexType name="BAPIRET2">
- <xsd:sequence>
<xsd:element name="TYPE" type="tns:char1" />
<xsd:element name="ID" type="tns:char20" />
<xsd:element name="NUMBER" type="tns:numeric3" />
<xsd:element name="MESSAGE" type="tns:char220" />
<xsd:element name="LOG_NO" type="tns:char20" />
<xsd:element name="LOG_MSG_NO" type="tns:numeric6" />
<xsd:element name="MESSAGE_V1" type="tns:char50" />
<xsd:element name="MESSAGE_V2" type="tns:char50" />
<xsd:element name="MESSAGE_V3" type="tns:char50" />
<xsd:element name="MESSAGE_V4" type="tns:char50" />
<xsd:element name="PARAMETER" type="tns:char32" />
<xsd:element name="ROW" type="xsd:int" />
<xsd:element name="FIELD" type="tns:char30" />
<xsd:element name="SYSTEM" type="tns:char10" />
</xsd:sequence>
</xsd:complexType>
- <xsd:element name="ZSMS_INBOUND">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="DATE" type="tns:date" />
<xsd:element name="MESSAGE" type="tns:char170" />
<xsd:element name="MODEMID" type="tns:char10" />
<xsd:element name="SMSID" type="tns:char17" />
<xsd:element name="TEL" type="tns:char20" />
<xsd:element name="TIME" type="tns:time" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="ZSMS_INBOUNDResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="RETURN" type="tns:BAPIRET2" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="ZSMS_INBOUND">
<wsdl:part name="parameters" element="tns:ZSMS_INBOUND" />
</wsdl:message>
- <wsdl:message name="ZSMS_INBOUNDResponse">
<wsdl:part name="parameters" element="tns:ZSMS_INBOUNDResponse" />
</wsdl:message>
- <sap:Feature name="design_0" uri="http://www.sap.com/webas/630/soap/features/authentication/">
- <sap:Property qname="n0:AuthenticationLevel">
<sap:Option value="n0:None" />
</sap:Property>
</sap:Feature>
- <wsdl:portType name="ZSMS_INBOUND">
<sap:useFeature feature="tns:design_0" />
- <wsdl:operation name="ZSMS_INBOUND">
<wsdl:input message="tns:ZSMS_INBOUND" />
<wsdl:output message="tns:ZSMS_INBOUNDResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="ZSMS_INBOUNDSoapBinding" type="tns:ZSMS_INBOUND">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="ZSMS_INBOUND">
<soap:operation soapAction="" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="ZSMS_INBOUNDService">
- <wsdl:port name="ZSMS_INBOUNDSoapBinding" binding="tns:ZSMS_INBOUNDSoapBinding">
<soap:address location="http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I'm now able to consume the web service, but with the error as below:
Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !
Error Message is :com/sap/guid/GUIDGeneratorFactory
BAPIRET2 mappingInfo:
TYPE TYPE false false 11
ID ID false false 11
NUMBER NUMBER false false 11
MESSAGE MESSAGE false false 11
LOG_NO LOG_NO false false 11
LOG_MSG_NO LOG_MSG_NO false false 11
MESSAGE_V1 MESSAGE_V1 false false 11
MESSAGE_V2 MESSAGE_V2 false false 11
MESSAGE_V3 MESSAGE_V3 false false 11
MESSAGE_V4 MESSAGE_V4 false false 11
PARAMETER PARAMETER false false 11
ROW ROW false false 11
FIELD FIELD false false 11
SYSTEM SYSTEM false false 11
My java code is :
public class MyTest {
public static void main(String[] args){
try{
Stub stub = (Stub)new ZSMS_INBOUNDServiceImpl().getLogicalPort();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,"http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100");
ZSMS_INBOUND inboundService = (ZSMS_INBOUND) stub;
BAPIRET2 str = inboundService.ZSMS_INBOUND(param1,param2,param3,param4,param5,param6);
System.out.println(str.toString());
}catch (Exception e) {
e.printStackTrace();
Similar Messages
-
Error consuming Web service from an ABAP Program
Hello guys,
I'm trying to consume a Web Service that is exposed in the internet. The conecction to the Web Service its via SSL.
I'm having a problem at the moment I call the web service from my abap program. But I'm able to test the same web service, from the SE80 tx with out trouble.
I have identify that there is a difference in the SOAP envelope, that its received in the Web service, when I call it from the test enviorment and when I call it from the program.
This is how it is received from the TEST tool (a succesfull call of th WS) :
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header><n0:Trace xmlns:n0="http://www.sap.com/webas/630/soap/features/runtime/tracing/"><TraceLevel xmlns="http://www.sap.com/webas/630/soap/features/runtime/tracing/">Error</TraceLevel></n0:Trace></soap-env:Header><soap-env:Body><nr1:putXMLDocument xmlns:nr1="http://bel.bci.cl/WsBEL/services/Carga"><body><?xml version="1.0" encoding="ISO-8859-1"?><Mensaje><RutEmpresa><Numero>76555400</Numero><Digito>4</Digito></RutEmpresa><RutUsuario><Numero>12307972</Numero><Digito>8</Digito></RutUsuario><Convenio>58422</Convenio><Pin>aro79728</Pin><Archivo><Tipo>PPR</Tipo><Plantilla>2142970592</Plantilla><Nombre>cargatest174.txt</Nombre><Cuerpo><![CDATA[G126919727 JORGE CRISTIAN VARGAS ROMERO 0000VVC01600000000000000000000245FAC0000000089900032000021030000010000000000190000 2910200714082008Boletas honorarios|]]></Cuerpo></Archivo><Fecha>20080814</Fecha></Mensaje></body></nr1:putXMLDocument></soap-env:Body></soap-env:Envelope>
And this is how it is received when I consume the web service from the ABAP program.
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header><n0:Trace xmlns:n0="http://www.sap.com/webas/630/soap/features/runtime/tracing/"><TraceLevel xmlns="http://www.sap.com/webas/630/soap/features/runtime/tracing/">Error</TraceLevel></n0:Trace></soap-env:Header><soap-env:Body><nr1:putXMLDocument xmlns:nr1="http://bel.bci.cl/WsBEL/services/Carga"><body><?xml version="1.0" encoding="utf-8" ?><nr1:putXMLDocument xmlns:nr1="http://bel.bci.cl/WsBEL/services/Carga"><body><?xml version="1.0" encoding="ISO-8859-1"?><Mensaje><RutEmpresa><Numero>76555400</Numero><Digito>4</Digito></RutEmpresa><RutUsuario><Numero>12307972</Numero><Digito>8</Digito></RutUsuario><Convenio>58422</Convenio><Pin>aro79728</Pin><Archivo><Tipo>PPR</Tipo><Plantilla>2142970592</Plantilla><Nombre>cargatest174.txt</Nombre><Cuerpo><![CDATA[G126919727 JORGE CRISTIAN VARGAS ROMERO 0000VVC01600000000000000000000245FAC0000000089900032000021030000010000000000190000 2910200714082008Boletas honorarios|]]></Cuerpo></Archivo><Fecha>20080814</Fecha></Mensaje></body></nr1:putXMLDocument></body></nr1:putXMLDocument></soap-env:Body></soap-env:Envelope>
As you can see, it is generating a nr1:putXMLDocument tag, that it should not go there.
Why do you think that this situation is happening? Please guys, this is very important, and need your help. Thanks in advance.
Samuel.BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP
Calling WebServices from ABAP via HTTPS
Consuming Web Service from ABAP by Durairaj Athavan Raja
Search on SDN wiki, and you will find above mentioned links. -
Problem consuming Web Service from ECC 6.0 using dual certificates
Hi, I am trying to consume a secure web service on ECC 6.0 - so far without much luck.
When I try to connect to the ws server, it seems there are three certificates in action: a CICS certificate for establishing the SSL connection, a 'root' certificate from the PKI certificate issuer, and a private certificate issued by the above issuer (please forgive me if a have the syntax wrong - certificates are not my primary line of work). So, using Trust Manager (STRUST), I have created a PSE named 'OES' and imported all three certificates into it.
In SOAMANAGER I have set up the end-point using the WSDL-file and set the following parameters:
- Authentication Method = X.509 Client Certificate
- Trustworthiness Method = Holder of Key
- Issuer = <issuer from the root certificate>
- Name of Attester = <blank>
- Validity of SAML Assertion = 180
- Caching of SAML Assertions = False
- Attester System Destination = <blank>
- Name of Attester = <blank>
- User = SRxxxWS
- Password = <blank>
- Client PSE = OES
When I try to consume the web service, I can see in the log files that the CICS certificat is used for establishing the SSL connection but all I receive back is an HTTP 403 "Client Authentication Error". If I remove the CICS certificate from the PSE, the connection is not made.
How do I make the client certificate available for the connection? Have I approached the problem from the wrong side? Has anybody experienced something similar? Any help will be highly appreciated.
Thanks,
BoHi,
I am not Certificate expert either but you can get plenty of help from "Security" forum on SDN. I can help you bit with some related SAP notes and forum answers:
See following notes :
1324884 - Analysis of ABAP Web Service SOA Configuration
1318906 - Trace analysis of SSL problems
1319507 - Overview: Analysis of ABAP Web Service Configuration
See this forum discussed about consuming secured ws in webdynbpro:
Problem in Calling Secure Webservice.
Articles:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/92914af6-0d01-0010-3081-ded3a41be8f2&overridelayout=true -
Web Services Security Configuration Guide (discussed IBM and NW WS security but you can find some examples and hints there)
Regards,
Gourav -
Problem consume Web Service in SAP
Hi experts,
I need your help to solve this problem.
I must consume one Web Service, but my SAP R3, don't interprets the XML.
(SE80 - > enterprise services -> create -> Service Consumer )
i tried to put the URL and copy to text file , neither worked,
the Error:
Exception occurred in communication framework:Error in File Upload:
rc=1 C:\Users\XPTS853\Desktop\array.xsd
solution remove this line
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="array.xsd";/>
now give me this error:
Exception occurred in library handler
Illegal syntax: Extension element http://schemas.xmlsoap.org/wsdl/soap/:operation not valid in element operation
can you help me? suggestions ?
note: i use complex structures are they the problem?
<complexType name="operationInD">
<sequence>
<element name="MN" type="string"/>
<element name="Nile" type="int"/>
<element name="NewMainB" type="float"/>
<element name="NCode" type="string"/>
</sequence>
</complexType>hi thanks,
my WSDL is valid..
the error is base in interpretation of XSD... i think..
Incorrect value: XSD namespace not available
thank. the file is great, but is not related with this problem... (i have all supported tag´s) -
Problem consuming web service with basic authentication
Hello,
I've set up a web service with basic authentication. Although I have to log in before being able to open the overview page of the web service in the Web Service Navigator, the response I get after sending a request is:
Authority check failed
I get this response in the Web Service Navigator as well as when consuming the web service via standalone proxy classes.
The following is strange, too: It is not possible to change authentication in the generated logical port. It is set to "none". I changed it via the XML file where I added the properties "AuthenticationMethod" (value "BasicAuth") and "AuthenticationMechanism" (value "HTTP"). But I got the above response anyway.
Thanks for your help!
RegardsI used basic authentication for my web service.
I was able to obtain a hardcopy of the logfiles in the meantime. The invocation of the web service is stored there with the following error messages:
<i>SOAP Runtime: Exception message: Schwerer Prozessierungsfehler macht eine SOAP-Fault-Behandlung erforderlich
SOAP Runtime: SOAP Fault exception occurred in program CL_SOAP_RUNTIME_SERVER========CP in include CL_SOAP_RU NTIME_SERVER... [the picture is cut here]</i>
In addition to that I found a thread in SDN that dealt with exactly the same problem:
Web Service Homepage: Authority check failed
But I have the same problem like Kimberly Carmack (the last post on the second page). We do not have that role in our system. -
Hello,
I have the following code:
REPORT zprueba6.
DATA: zws TYPE REF TO zsondaco_consulta_estado_pago.
DATA: lo_system_ex TYPE REF TO cx_ai_system_fault.
DATA: lo_app_ex TYPE REF TO cx_ai_application_fault.
DATA: ls_input TYPE zsondaconsulta_estado_pago_se1.
DATA: ls_out TYPE zsondaconsulta_estado_pago_ser.
START-OF-SELECTION.
TRY.
CREATE OBJECT zws.
CATCH cx_ai_system_fault .
ENDTRY.
break josechau.
TRY.
CALL METHOD zws->consulta_estado_pago_service_o
EXPORTING
input1 = ls_input
IMPORTING
output1 = ls_out.
CATCH cx_ai_system_fault INTO lo_system_ex.
WRITE: / 'System fault occurred', lo_system_ex->errortext.
CATCH cx_ai_application_fault INTO lo_app_ex.
WRITE: / 'Application fault occurred ', lo_app_ex->textid.
CATCH cx_sy_ref_is_initial.
WRITE: / 'Object is initial'.
ENDTRY.
I have created the Proxy Class and I have created a logic port in lpconfig for this proxy class.
When I run this program or any program using any Web Service I receive the following exception:
System fault occurred Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/
Any help would be appreciated.
Best RegardsFinally I used another WS.
We suppose it is a problem with the WSDL Schema but we are not sure.
Best Regards -
How to consume web service in WDP ABAP ---HTTP error (return code 404, mess
Hi,
Am trying to consume a web serivce in WDP where I got error HTTP error (return code 404, message "conn failed")in sdn i came to know that it could be resloved by giving the IP address of the host but in case it is not the web services am using are the external links.
kindly help me to sort it.
Regards
Rajhi,
in addition to above thread
refer this too
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0d4aa08-beed-2a10-fab2-ad975cead04a
bvr -
Hi all, I'm developping my first web application using Apache Tomcat and Axis, using servlets, jsp and web services.
My problem is that I cannot make any call to my web service (a very simple one) because I get the following exception:
<code>
java.lang.reflect.InvocationTargetException CAUSA: null
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.reflect.InvocationTargetException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:lexis02
java.lang.reflect.InvocationTargetException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
</code>
The stack trace is longer than that, but I didn't find any hints to solve the problem.
The exception is thrown for every method of the web service:public java.lang.String[] getMessage(java.lang.String , int) throws java.rmi.RemoteException
public boolean addMessage(java.lang.String, java.lang.String, int)
throws java.rmi.RemoteException
I'm using stub to call the web service, as generated by wsdl tool.
Can someone help me?
Thanx
PS: sorry for the double message but I pressed the wronk key at the wrong time :) -
How to Consume Web Service?
Hi Experts,
I need to call a Function Module in the Exit.
In this Function Create to write the code to consume web service created by third party.
Then get the Data from there and uodate SAP
Can u plz help me with the Steps Involved in this?Hi Mohsin,
Please chk this link once for consuming web services..
http://help.sap.com/saphelp_nw70/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/frameset.htm
http://help.sap.com/saphelp_nw04/Helpdata/EN/b4/6aae409567942ae10000000a155106/content.htm.
U shuld have authorizations for tcodes WSADMIN and SOAMANAGER for creating web services
Hope it will be useful..
Regards,
Lakshman.
Edited by: Lakshman N on Jan 13, 2009 12:06 PM -
Problem at Consume WEB Service in ABAP
hello!!
I tell them my problem, is to create a web service from the SE80, which could be used properly.
Then there was a change of server, which migrated to the developments and the web service is recreation, but this can not be consumed.
now I need help, is where do I indicate that the basis so that they can return to consume web services, what services or settings should be activated.
any suggestion or help are welcome.
The ECC system is a 5 AS ABAP only.
from now, I appreciate any help or guidance I can get.What is the problem? Are all the services active in SICF for web services and how is the web service being consumed is it through a wsdl file ?
-
Issue in creating web service for a ABAP Function Module
Hi,
now i'm learning how to create web service for a ABAP Function Module. I used the following steps.
1. select the Function Module, named "zws_test".
2. in the context menu, select "create->proxy object". so we enter into wizard.
3. in the wizard, press the radio button "Service Provider".
4. in the next page, press the radio button "Existing ABAP Objects(Inside Out)".
5. In the next page, Enter the "zws_test_prvider" as Service Definition and select "Function Module" as Endpoint Type.
6. in the next page, enter "zws_test" as Function Module and mark the "Mapping der Namen" button
7. in the next page,select "PRF_DT_IF_SEC_LOW" as Profile and mark "Deploy Service".
8. Save in the local package.
9. then it will pop up a window with title "WSDL Source". i selected "URL/HTTP Destination" and press "OK".
10.in the next page, i enter the URL as "http://hostname:portnumber/", and press "OK".
11. then it will pop up a window with title "Display logs". A record with error message "HTTP error(return code 404, message "Not found")" appears.
12. i press "ok" and a service provider with name "zws_test_prvider" appears in my local package.
13. i use "zws_test_prvider"'s URL to create a service consumer "ZCO_WS_TEST_CONSUMER" and logic portal "LP1".
14. But when i test my service consumer "ZCO_WS_TEST_CONSUMER", it will throw an exception "cx_ai_system_fault" with errortext "SOAP:14 Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/".
15. I use t-code SM59 to test connection and get the following info.
Status HTTP Response 200
Status Text OK
Duration Test Call 328 ms.
who can give me the reasons about item 11 and 14, and explain me how to create service provider and service consumer for a Function Module.
Thanks in advance
Johnneyhave you seen this weblog
/people/thomas.jung3/blog/2004/11/15/bsp-150-a-developer146s-journal-part-xiii-developing-abap-webservices -
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.
-
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. -
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. -
Consuming EJB Web Service in WD ABAP component
Hi,
I have a scenario where I have Portal KM access methods exposed as EJB Web Service. This web service is deployed on J2EE engine.
And I have to consume this web service from my WD ABAP component controller.
Any idea how this can be achieved?
Thanks and regards,
AmeyThis doesn't really have anything to do with Web Dynpro. Normal ABAP functionality is used for the consumption of a web service. In ABAP we create a proxy class based off the WSDL of the web service. This proxy class can then be called from within Web Dynpro like any other ABAP class. You can read about consuming a web service in the online help:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/9e/c7a3591dc74a679bbc9716354e42af/frameset.htm
Maybe you are looking for
-
Trying to load loops into loop browser, garageband says " loops not in garageband format will not be displayed in browser' - this has not happened before. aiff files were shown, how to get browser to show aiff loops? thanks. 4bs.
-
Clearing of Open items - Critera - Auotomatic Payment Run
Dear Friends, We have configured the Automatic Payment Run in the system and are in the process of maintaining the integration with the Bank. When we import the Electronic Bank Statement, we find that instaed of 'Value Date' some otehr reference gets
-
BAPI_DOCUMENT_CREATE2 in Web Dynpro ABAP
Hi Friends, I want to upload PDF file from my System and get it stored in content server Using WEB DYNPRO APPLICATION. I tried using it by calling the FM but its not uploading the file in the server. Can i know the steps involved in uploading t
-
How to send other language data into excel file in attachment thru mail
Hi - , I have to send other language data (russian) into excel file and send as an attachment through e-mail. I had used F.M SO_NEW_DOCUMENT_ATT_SEND_API1 to send email. In internal table , it is in correct format, but when using SO_NEW_DOCUMENT_ATT_
-
Rolluptime (LastDataRefresh) on infosets
Hello, We have in our BW 3.5, infoproviders with information from MIC compontent (Internal Control). These infoproviders are mainly infosets that sometimes join ODS and characteristics (type 1), but sometimes have just characteristics as its componen