Skip to Content
Author's profile photo Former Member

Integrating an External Webservice in FP4.0 (Quick ,Dirty, and Simple)

Well After 2 years of wishing for this it is finally here.  I spend some time testing this out , so I thought I would put this together to help everyone utilize/learn this functionality… And if I miss something then you can Help me as this is my first attempt at using it.

I will be using http://www.webservicex.net/stockquote.asmx?WSDL   as my WSDL

(Note Modifications are needed to this WSDL.. ByDesign only supports one PortType so you will need to remove all but one definition in this file)

First Lets Create a new “External Web Service Integration”

Untitled-2.jpg

Select the WSDL File you wish to integrate with

Untitled-4.jpg

Hit next… (I do not have any Schema Documents with the WSDL so I am not including it in this Tutorial But might in the future)

Then Hit finish

Untitled-5.jpg

Now you have Created a *.wsid file in your Solution  Right Click and activate it.

Next you will need to Define a Communication Scenario

Untitled-6.jpg

Untitled-7.jpgUntitled-8.jpg

Review your Data and finish. and Activate the newly created *.csd File

Now you will need to log into Bydesign as a Key User… And create a new Communication Agreement  (Under Application and user Management)

Untitled-9.jpg

After Choosing the Business Partner click next.

Untitled-11.jpg

On the Technical Data Section click “Edit Advanced Settings”

Untitled-13.jpg

Fill out the following settings (these are specific for the webservice mentioned above)

Untitled.png

Complete the Setup Process….

Now back in Bydesign studio  Create a new BO I named it StockBO

import AP.Common.GDT as apCommonGDT;
businessobject StockBO {
                    element StockQuoteID : ID;
                       element StockSymbol : LANGUAGEINDEPENDENT_Text;
                    element StockPrice : LANGUAGEINDEPENDENT_Text;
}

and then created the Script file for the Before Save

import ABSL;
var requestQuote:Library::ExternalWebServiceIntegration1.GetQuote.Request;
requestQuote.symbol = this.StockSymbol;
// Call the external web service Calculator in the format (<request variable>,”<business partner ID>”,”<communication scenario name”) and prepare the response variable
var responseQuote = Library::ExternalWebServiceIntegration1.GetQuote(requestQuote, "1000000", "CommunicationScenario1");
// Capture the communication faults that occurred during execution
var commFault = responseQuote.CommunicationFault;
 this.StockPrice = responseQuote.GetQuoteResult;

I created a QAF (Quick Activity Floorplan) previewed it and

Untitled-1.jpg

It Worked that was easy.. well should be for you now.. there was a lot of trial and error and documentation searching on my side…

Now are there some things I would do different… Probably..

  • I would try to use a “Application Integration”… But could not find info on calling it..
  • If my Webservice had a Schema Doc then my result would be easier to read..
  • I could go on and Parse my String to have only the Price but you get the Idea…
  • If I did a B2B communication I would probably use a BCO (http://scn.sap.com/docs/DOC-31216) so the BusinessPartnerId could be set per instance for scalable solutions

I was so Excited about the new Feature I had to give it a quick go and thought I would share it with everyone out there.

Assigned Tags

      15 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Thomas Schneider
      Thomas Schneider

      Hi Billy,

      I love this tutorial !!! Let me add two comments:

      1) I would recommend to add some error handling. I describe a demo script with simple error handling in my document External Integration of Custom Solutions in SAP Business ByDesign / SAP Cloud for Customer (see section Call Web Services (SOAP) from Custom Code (BO Integration).

      2) You are asking about Application Integration, which is definitely the better choice for your use case instead of using a "dummy business partner". You have to change 3 things:

      a) use "Application Integration" in the wizard.

      b) in ABSL coding leave the BPID empty :

      var responseQuote = Library::ExternalWebServiceIntegration1.GetQuote(requestQuote, "", "CommunicationScenario1 ....

      c) In the Application and User Mgmt woc, define a Communication System (own view) and select this communication system in the communication scenario (there is an input field communication system instead of the Business Partner field).

      Best regards,

      Thomas

      .

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks Thomas.  I agree on the Error handling.. For me this was a Quick see if I can figure it out test. But that is needed. ( I had it in there before but for some reason it would not activate)

      And for the Application Integration.. I thought leaving it blank might do it but was unsure thanks for clarifying that for me.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      On a Side Note Thomas, I would really like it if the Import WSDL File Section of the Wizard would also accept a URL.. and if it could possibly parse that WSDL (URL) for the Location of any Schema Documents and download them also... Just a Suggestion.

      Author's profile photo Former Member
      Former Member

      Thanks a lot Billy, it's very interesting, as soon I have a tenant FP4.0 I will prof it =)

      Author's profile photo Former Member
      Former Member

      Hi Billy, looks great this info,

      I was trying this: http://www.service-repository.com/service/overview/877027757

      using a calculator to learn how to use the external web service integration.

      but while I'm following this I got errors, then I got a couple questions, well, maybe more

      1 - Its a Communication System necessary right?, this to have a partner to use in the communication arrangement, I see you use Almika with ID = 1000000

      If that's right, then what I need to put in the hostname for the partner? WSDL? Endpoint?

      2 - Then, in the Communication Arrangement / Technical Data / Advanced Settings

      Hostname must be the same as the partner in communication system? or what do I need to use here?, the path is only the web address? I get by default the port 443, or I need to use 80?

      But when I try to consume this I get the error that "No Comm. Arrangement exists for Comm. Scenario  and Business Partner"

      When I check the Communication Arrangement, the check service works fine, it seems but when I try check connection I get this error:

      "Checking Connection Failed

      Ping failed

      Error accessing service; Service Ping ERROR: Error when calling SOAP Runtime functions: SRT: Processing error in Internet Communication Framework: ("ICF Error when receiving the response: ICM_HTTP_TIMEOUT") ()"

      Any hint that helps me to finish this tutorial?

      Thanks in advance.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      1. Yes you need one... Either a Business partner one or a B2B... I would use Application in the future...your host name is the Domain of your webservice.. in your case   the host is ws1.parasoft.com and is based off the endpoint

      2. Hostname is sill same as I said in #1...As this is not a HTTPs domain you will need to use HTTP protocol and port 80... the path is the Location of the WSDL excluding the domain... so for your case the path is glue/calculator  (MY image is bad let me edit it and put a new one up)

      Author's profile photo Former Member
      Former Member

      Thanks Billy, but there is another thing that I skipped and didn't notice, I can't mark the "Allow non secure URL" .... I don't have that option, there is a way to make this appear?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      That option is not available on the Communication Scenario Definition Wizard from with in BYD Studio?  Here is the help file on that and I not not see any reason why it would be readonly or not there...

      https://my020062.sapbydesign.com/sap/a1s/cd/wkt/doc/KTP/Products/A1S_PDI/DevTasks/Web_Services/HT_AllowNonsecureURLs.xml?ptc=text%2fhtml&prof=X&print=&COMPONENT=A1S_PDI&RELEASE=400&LANGUAGE=en&REGION=&INDUSTRY=&TASK=CR_VIEW

      Author's profile photo Former Member
      Former Member

      yeah.... in the wizard inside the ByD Studio, that option it doesn't appear, I really dont know why, I've seen that info too in the help file .... maybe I need to report as an incident, thanks anyway, I'll check that

      /wp-content/uploads/2012/10/prueba_150528.png

      Author's profile photo Thomas Schneider
      Thomas Schneider

      Hi Angel,

      The http feature was recently downported. Did you update your SDK recently?

      Regards, Thomas

      .

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      I am using

      build  40.0.1345.245

      Build Date  2012-09-06

      Author's profile photo Former Member
      Former Member

      Yeah, I am using

      build: 40.01330.1558

      Build Date: 2012-08-22

      That could be the issue... Ill check that, thanks again =)

      Author's profile photo Former Member
      Former Member

      Hi all, I'm trying to consume a web service that have many classes, the problem is that, when I load it, I'm just able of see 1 class, so, I don't know if I'm doing something wrong but I'd like you to help me with this.

      Thanks in advance.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Honestly... I have only been able to get this to work with fairly basic web services.. you will probably need to do a service ticket to resolve it.

      Author's profile photo Former Member
      Former Member

      Hi Billy, thanks for your answer, actually I think you're right, I already raise an incident so I hope to have an answer soon, when I get it, I will post it to help somebody else.

      Thanks again.

      Best regards.