Consuming ABAP webservice in Java

Hi Gurus,
We are publishing webservices from SAP and Java team is consuming them. For accessing the webservice  from java , we are maintaining User name and Password in SICF for that service.
Now if we donot maintain the User name and Password in SICF for that service then Exception "Unauthorised " is coming in Java.
We want to pass the User name and Password from Java. How to achieve this.
Thanks
Jitendra

Hi John,
thnx for quick response. i have given WSDL to Java team but they are unable to find " Logon service in the WSDL".
Can u tell us for which XML tags we should search.
Thanks
Jitendra

Similar Messages

  • Consuming MII WebService in Java WebDynpro

    Hello,
    We are facing a strange situation...
    We define a transaction in MII to be consumed as WebService in Java WebDynpro. This transaction is a simple query on a DB returning 4 fields :
    Shift code : SHIFT
    Shift description : DESCRIPTION
    Start time : START_TIME
    End time : END_TIME
    It works fine, we use the import adaptative web service wizzard in netweaver developper studio to use this WS...
    But if we to an update on the webservice, changing a field name for example (SHIFT -> SHIFTCODE), we start to have trouble...
    We got then the very helpful error message :
    Exception on execution of web service with WSDL URL '<sever>/WebServices/GetShift' with operation 'Xacute' in interface 'XacuteWSSoap'
    If I display the model info using wdContext.currentRequest_XacuteElement().modelObject().associatedModelClassInfo().getModelInfo().toString()
    I got the following (extract) :
    <ModelClassPropertyInfo name="SHIFT" dataType="com.sap.tc.webdynpro.model.webservice.types.string(java.lang.String)" readOnly="false" qName="SHIFT" required="true" backendType="null"/>
    As you can see, the model definition is NOT updated and we still have SHIFT as name instead of SHIFTCODE...
    If someboby has an idea, it will save us our life ;o)
    Thank you
    PS:it the same behaviour if we add a field...

    Oliver -
    Did you try to reimport the WS model ..? If yes and still doesn't work...Try  to delete the old proxy in webdynpro ( adoptive ws) and import again.
    To avoid code changes,you can give same old name while fresh import.
    Adoptive WS in webdynpro  is not really like Adoptive RFC .It has some limitations.
    Thanks
    Hari

  • Consuming ABAP Webservice in Webdynpro app

    Hi,
    I have wrote a webdynpro app for consuming ABAP webservice. I used the procedure in the link below
    http://wiki.sdn.sap.com/wiki/display/WDJava/ConsumingABAPWebServiceinJavaWD
    Everything seemed to be went well, I created model and Webservice destinations. I have written the code for calling the webservice, which does not return data as part of response. I mean though the RFC returns data at the backend,its not showing the returned records in the webdynpro table.
    I have also tried checking the same by setting external break point. when the webservice is executed from my webdynpro app,it goes to the ABAP debugger and i could clearly see the records in the export parameters of RFC,but the same is not returned in the reponse object.
    Could any one let me know what could be missing. Any help is greatly appreciated?
    I have used the following code in Init method of my View
    Request_ZMYRFC input=new Request_ZMYRFC (model);
    wdContext.nodeRequest_ZMYRFC ().bind(input);
    ZMYRFC  req= new ZMYRFC (model);
    req.setPUserid("EDLAS00C");
    req.setPLtc("E");
    input.setMYRFC (req);
    IWDMessageManager manager = wdComponentAPI.getMessageManager();
        try
        wdContext.currentRequest_ZMYRFCElement().modelObject().execute();
          wdContext.nodeResponse().invalidate();
          wdContext.nodeZMYRFCResponse().invalidate();
          wdContext.nodeReturn_res().invalidate();
         wdContext.nodeItem_res_ret().invalidate();
          wdContext.nodeILtcg_res().invalidate();
          wdContext.nodeItem_res_ltcg().invalidate();
        catch(Exception e)
          manager.reportException(e.getMessage(), false);
    Thanks
    Santhosh

    santosh,
    Check provider system defination in nwa for webservice.After this mapp the provider system and service group after wd app deployed.This is mandatory while consuming webservice in webdynpro for latest versions of CE7.11 or later.for reference check this article/document. http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/50d70a19-45a3-2b10-bba0-807d819daf46
    Thanks,
    Murthy.
    Edited by: Murthy Karaka on Mar 22, 2010 12:59 PM

  • Consume ABAP Webservice using AJAX javascript

    Hi,
    We created webservice for  ABAP BAPI. And I want to consume this using AJAX javascript.
    But I am getting "Access Denied" javascript error.
    Please let me know how to pass the credentials while trying to consume this webservice
    I tried below code, but its NOT workng
    var URL ="http://hostname/sap/bc/srt/rfc/sap/servicename?sap-client=400&sap-user=testuser&sap-password=testpassword";
    xmlhttprequest.open("POST", URL, true);
    Please let me know your thoughts ...
    Thanks
    Edited by: sona p on Feb 27, 2010 12:18 AM

    Hi,
    Thanks for your response. I did the same as mentioned in the link provided by you. But it is not working . I am still getting "Access denied" javascript error in the second line ( xmlhttprequest.open) . Below is my code.
    var auth = make_base_auth('userid','password');
    xmlhttprequest.open("POST", URL, true);
    xmlhttprequest.setRequestHeader('Authorization', auth);
    xmlhttprequest.setRequestHeader ("Content-Type", "text/xml");
    xmlhttprequest.onreadystatechange = getDataList;
    xmlhttprequest.send(SOAPEnvelope);
    Please let me know your thoughts. Thanks again for your response.

  • Consuming ABAP Webservice from Android device

    Dear Experts,
    I am ABAP developer (limited knowledge on android) trying to connect  Android device to a.SAP Webservice
    Through trial and error and help from SDN and Android forums i managed to link up the ABAP webservice and android using KSOAP2 API.Its working perfectly now but only when i save the username password for SAP access in the webservice settings in transaction SICF.I need to access the service by passing the username and password values through the SOAP request header but so far my efforts have failed me.im presently using the following code to pass my auth values.
    I would be grateful if you can point me in the proper direction.
           String NAMESPACE = "mynamespace (works properly without auth)";
            String METHOD_NAME = "mymethod (works properly without auth)";
            String SOAP_ACTION = "mynamespace/mymethod (works properly without auth)";
            String URL = "myURL{works properly without auth)";
            SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
            Request.addProperty("Purchaseorder","4500001168");
            Request.addProperty("Username", "myusername");
            Request.addProperty("Password", "mypassword");
           SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
           envelope.setOutputSoapObject(Request);
           HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    try
               androidHttpTransport.call(SOAP_ACTION, envelope);
               SoapObject response = (SoapObject)envelope.bodyIn;
               String testValue =  response.getProperty("PoHeader").toString();
               AlertDialog alertDialog = new AlertDialog.Builder(this).create();
               alertDialog.setMessage(testValue);     
               alertDialog.show();
           catch(Exception e)
                e.printStackTrace();
    Thanx & Best Regards

    Hi,
    you can develop a custom Transport class wich extends the: HttpTransportSE class by authentication features.
    example:
    public class AuthTransportSE extends HttpTransportSE{
         private String username;
         private String password;
         public AuthTransportSE(String url, String username, String password) {
              super(url);
              this.username = username;
              this.password = password;          
         protected ServiceConnection getServiceConnection() throws IOException {
              ServiceConnection midpConnection = new ServiceConnectionSE(url);
              addBasicAuthentication(midpConnection);
              return midpConnection;
         protected void addBasicAuthentication(ServiceConnection midpConnection) throws IOException {
            if (username != null && password != null) {
                StringBuffer buf = new StringBuffer(username);
                buf.append(':').append(password);
                byte[] raw = buf.toString().getBytes();
                buf.setLength(0);
                buf.append("Basic ");
                org.kobjects.base64.Base64.encode(raw, 0, raw.length, buf);
                midpConnection.setRequestProperty("Authorization", buf.toString());
    Afterwards you can initialize the Webservice with:
    AuthTransportSE androidHttpTransport = new AuthTransportSE(URL, userName, pasword);
    Cheers,
    Dennis.

  • Consuming ABAP Webservice in webdynpro java.

    hi All,
    i tried the all ways provided in sdn to create a webservice in ABAP when i test its working fine on j2ee server.
    when i call the same webservice from webdynpro its throughing this error can any body kindly help me in this.
    java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (502) Proxy Error ( The ISA Server denied the specified Uniform Resource Locator (URL).  ). The requested URL "xxxxxxxxxx".
    Thank you.
    venkat.

    Hi Venkatramana,
    The class of the ProxyGenerator is com.inqmy.lib.wsdl.ProxyGenerator. It is located in <SAPj2eeEngine_install_dir>/cluster/server/additional-lib/inqmysoap.jar or <SAPj2eeEngine_install_dir>/alone/additional-lib/inqmysoap.jar file. In addition the following JAR files must be included in your classpath - mail.jar, activation.jar, inqmyxml.jar, inqmysoap.jar, located in <SAPj2eeEngine_install_dir>/cluster/server/additional-lib/ or <SAPj2eeEngine_install_dir>/alone/additional-lib/ directory. You need also the inqmy-lib.jar file in <SAPj2eeEngine_install_dir>/cluster/server/lib/ or <SAPj2eeEngine_install_dir>/alone/lib/ directory in order to run the generator.
    SAP Note : <a href="https://websmp201.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=547847&_NLANG=E">547847</a>
    Before deploying make sure the JCo’s are up and running
    Go to http://server:port/webdynpro/dispatcher/sap.com/tcwdtools/Explorer to check the status of JCo’s.
    Regards,
    Mithu

  • Consuming ABAP WS

    Hello gurus,
    please help me. I've faced problem with consuming ABAP webservice. Here's the original wsdl:
    [WSDL definition|https://docs.google.com/document/d/1QiuguhN4ZniOUFkWWq2J-uH6Jqjc5wYCvmloAgqDDWs/edit?hl=en]
    here's the response from WS:
    [WS Response|https://docs.google.com/document/d/14fIkoBBw92m8fNS-hdLsY2xYoieBBCtvhf7YGt_y4Vc/edit?hl=en]
    Question: how to enforce SAP to set prefix for all elements without prefix in the response xml? For instance i wanna have :
    <n0:IdIncomeRecord>1 </n0:IdIncomeRecord>
    intead of
    <IdIncomeRecord>1 </IdIncomeRecord>
    Thanks in advance.

    To my knowledge, there seems to be little support to manipulate the generation of WSDL. But, explore the SOAManager transaction for any help related to it.
    Regards,
    Sharath

  • Providing WS in ABAP and consuming the WS in JAVA and vice-versa

    Hi Folks,
    Pls help me in creating  the below mentioned scenarios.
    1) Providing Webservice in ABAP and Consuming in JAVA.
    2) Providing Webservice in JAVA and consuming in ABAP.
    Also...pls let me know what are the system requirements for the above 2 scenarios...
    Cheers...
    Ram.

    Ram,
    if you take that little effort to SEARCH this website, you'll be rewarded with dozens of blogs, whitepapers, technical articles and forum discussions elabaroting just what you are looking for.
    you can find the search box in the right upper corner.
    hava a nice day,
    anton

  • JAVA webservice to ABAP Webservice

    Hi,
    There is a Webservice developed in Java and published.
    The same webservice we are now develping in ABAP. Though there is no change in the functionality of the webserice, the WSDL generated for ABAP webservice is looking different than the one for JAVA. How to resolve this issue? I do  not want to ask the service consumer to regenerate the Clinet Proxy for the new WSDL.
    Could you please help me in resolving this issue?
    Thanks & Regards,
    Kishore Babu T

    Hello Johannes,
    Which WSDL do I need ? In the wsnavigator I can choose RPC or Document, and then Default or SAP_WSDL to download the WSDLs.
    Try this: [Accessing a Service|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b8/a3cca166d440c29931c0c5494c32e5/frameset.htm]
    And do I need to publish the webservice (which I want to consume) on the Java stack ? or ist it already published when the wsnavigator can access it ? (the service resides on the Java stack, and I want to consume it from the ABAP stack from the same system)
    In short, no. You can safely use the Web service without publishing it - as Olivier explained, you need only the WSDL.
    The "publishing" term is usually used when you register (publish) a Web service in the UDDI server or the Services Registry. Publishing is only relevant if you want other people to be able to locate the registered service in the UDDI server.
    Hope this helps,
    Rossen

  • Consuming a webservice in ABAP ECC 6.0 without using XI/ PI

    Hi Experts,
    I wanted to consume an external webservice without using XI / PI.After doing my homework and search on sdn I came to know that we can consume webservices in ABAP using proxies using SE80(Enterprise Services).
    I am trying to create a client proxy with the URL of webservice.It asks me the option to choose between URL or HTTP.
    I am selecting URL and in the second screen it asks about the package details and after that it finishes.Later I get an error message stating "NO VENDOR SPECIFIED".Its not allowing me to create a proxy.
    So, here are my questions.
    Does anyone faced the same kind of problem?
    Can we really consume a webservice without using XI / PI or any other middleware?
    Is it possible to consume the webservice only with URL or WSDL file ?
    Please let me know the exact process.
    Thanks in Advance.
    Shanker Pandey.

    Hi Martin,
      Please check these following links. Though you have reported already, these may help
    Proxy Object generation error using Wizard for Web Service Consumption
    Also, please have a look @ /people/thomas.jung/blog/2006/03/13/develop-a-web-service-that-sends-an-email--in-abap-netweaver-04s
    Hope this helps,
    Karthik

  • How to consume a ABAP webservice in a  webdynpro app?

    Hi,
    I have a BAPI in ABAP that is exposed as a webservice. I want to use this to build a webdynpro app so that i can consume this webservice. This BAPI returns the Employee data. As soon as the person logs into the portal i am going to pass his login id to this BAPI so that it retrieves the Employee data for that user id. But i need to know the procedure of consuming this webservice in a webdynpro app. Any pointers in this regard will be greatly appreciated.
    Thanks,
    Arun E V

    Hi Arun,
    Consumption of a web service is univesal I guess so it wont matter if it is an ABAP webservice. For consumtion of webservice in Web Dynpro you can go through the following tutorials
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/using%20car%20rental%20web%20service%20with%20web%20dynpro.pdf">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/using%20car%20rental%20web%20service%20with%20web%20dynpro.pdf</a>
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/creating%20an%20email-client%20using%20web%20dynpro%20and%20web%20services.pdf">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/creating%20an%20email-client%20using%20web%20dynpro%20and%20web%20services.pdf</a>
    Do reward points if it helps
    Regards
    Sid

  • Consuming PI Webservice from Webdynpro Java Not working

    Hello SAP,
    Environment: CE 7.2.
    Resolution expected immediately, Helpful answer is highly appreciated.
    Is the namespace should not exceed 60char for PI Webservice, for executing the webservice from Webdynpro Java.
    I tried with all the options in executing the PI Service from Webdynpro Java, None of the options worked. I am facing the below error while I was calling the PI Webservice.
    I don't see any problem from Webdynpro Java, what ever the procedure I have followed is the standard procedure.
    Fortunately when I execute the service from Webservice Navigator, it is working as expected. The same webservice when I consume it from Webdynpro Java it is not working
    Options tried so far:
    1) Published the Services to Service Registry and there by consuming the PI Service from Service Registry - Not worked
    2) Tweaked the URL with few options - Not worked (Tweaking the URL, ex: portType, Binding)
    3) Changing the Business Systems in PI and there after calling the service - Not worked
    4) Initializing the code, instead of creating Service Controller and calling the PI Service - Not worked.
    5) Created a Provider System and tried to call the PI Webservice from Provider System - Not Worked
    For all the Options, I am facing the same error which is provided in the screenshot.
    Below procedure which I have followed for calling the PI Webservice:
    1) Created Adaptive Webservice Model
    2) Provided PI Webservice URL (It prompts for PI System UserId and Password)
    3) Selected Option - No Service Group Configuration
    4) Provided Logical Destination
    6) Completed creation of Model
    7) Added the model as a UsedModel
    8) Right Click on Comp Contr. and selected Apply Template and Created a ServiceController for the model (Entire mapping to comp contr, Initializing the nodes is taken care by Service Contr.)
    9) Created an Template Action button and there by calling execute method which is auto rendered from CompContr..
    10) Build the project.
    11) Activated the code and Run the Application.
    12) Getting the below error which is showed in the message.
    ERROR MESSAGE:
    Exception on execution of web service on destination 'GetPIHRPeopleData' for operation 'SI_CreateHRPeopleData_OS' in interface 'SI_CreatePeopleCompany_OS'

    Hi Sankar,
    If the webservice is working fine in the Wsnavigator then there is some problem with importing the webservice in webdynpro for Java. Please check the required parameter for creating the Adaptive Webservice Model. After adding in the used model and compoent controller binding, you need to write code for to execute the webservice model.
    Please check the code for initialization and execution for the webservice and then test it.
    Best Regards,
    Arun Jaiswal

  • How to consume SOAP webservice in to my java/j2ee application

    Hi,
          I am a java developer. how to i consume SAP soap webservice in to my java application.
    scenario : 1
    We are migrating 2 specific java modules in to SAP System.But master details are stored in to my java application database.Those details are require
    to SAP application. So that they provide me WSDL file,  How to i consume soap webservice in to my java application and also, How to i provide master data details to SAP system through SOAP webservice.
    Any body provide me a detail instruction how to integrate SAP Application in to my java application using SOAP webservice. or
    In this scenario i will go for any one open source ESB to consume the soap webservice in to my java application, and provide master data to
    SAP application, can any one guide to me.

    Hi,
    What IDE are you using?, for example with Eclipse i used WSDL2JAVA plugin in this way i converted the WSDL in java classes easily. Depending your development environment you can use different tools that makes easier the integration using the WSDL.
    Regards.

  • Consume a WebService ABAP

    Dear,
    Need to develop a jsp that consumes a WebService ABAP (Authentication = High *).
    Using sso
    Could anyone help me?
    Edited by: Angelo Antonello Borges on Oct 16, 2009 7:07 PM

    What does SSO means here? Explain in detail. And answers for your questions you can read this:
    Error -- trying to invoke to other Web Service

  • Error While Consuming the webservice in ABAP

    Hi,
      I am trying to consume a webservice in ECC. I have imported the WSDL and generated the proxy. Did the configuration in the SOAMANAGER. While calling the webservice from the program I am getting the following error message. "SRT: Unsupported xstream found: ("HTTP Code 400  : Bad Request")"
       Any help is appreciated.
    Thanks
    Raghavendra Kuamr

    Hi,
    Check ST11 to find detailed log of issue, most likely you are passing "WS-A" message id along with request (check settings in SOAMANAGER Logical Port).
    Try calling service after suppressing "Message Id transfer". See SAP Note: 1361688 and related notes in 0001292171
    Regards,
    Gourav
    PS: please search forum before posting questions.

Maybe you are looking for

  • How come my videos wont play?

    i just updated my computer from the ancient version from like 2008 to the new maverick and now none of my videos in iPhoto will play. someone help please!

  • MR11_OLD and assignment number

    Hello, One of our program uses BDC for MR11_OLD , we found that it is trying to populate the assignment number field for all the items which are non GR/IR line items and this is not happeneing for all but few, I want to know how I can correct this pr

  • Adobe took my money, but I get no product?

    When attempting to download 'Adobe Photoshop Elements 11 & Adobe Premiere Elements 11' that I purchased, I get the error Your browser (Internet Explorer 4 or earlier) is not supported by macromedia.com. For the best possible experience, please use th

  • Sometimes my internet is very slow, sometimes none at all... DSL light is solid.....

    Internet light blinks rapidly , or goes out totally. Wireless light flashes. Sometimes unplugging/ replugging wireless modem helps. Sometimes not. There is a splitter / filter where the modem connects to phone jack.

  • BC4J: Getting a JDBC Connection out of an Application Module.

    Hi all! Good Morning! I have an application that uses JasperReports to print some reports. The filling mechanism of JasperReports requires a JDBC Connection object to work. At present, i am using the ConnectionMetadata Object from the AM to get the J