cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming a WebService

michael_voss2
Participant
0 Kudos

Hello everybody!

I need to consume a SOAP WebService from within a JAVA WebDynpro DC. I created a standalone web service proxy project in NWDS (currently, we are using 7.0.22) since I understood that creating a deployable proxy requires the web service to deliver WSIL, which the one we're going to use doesn't.

It looks like everything is working fine; the stubs got created and I added the proxy to the DC's public parts and marked these as used DCs in my WebDynpro and JAVA DCs. But when I add code to either my WebDynpro DC or another Java DC to instantiate the Stub class and call it's invoking method, I get an error shown saying "This compilation unit indirectly references the missing type com.sap.engine.services.webservices.jaxrpc.wsdl2java.BaseGeneratedStub" (or another class in this package).

Is there anyone who might give me a hint on what jar I'd have to import or if there is a more convenient way to consume a SOAP WebService from either a JAVA DC or a WebDynpro DC ? I'd appreciate any help, especially hints where I might find a manual or detailed instructions on how to do this.

Thanks

Michael

Accepted Solutions (1)

Accepted Solutions (1)

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

How about this document: Consuming Web Services in Web Dynpro Java  or Adaptive Web Service Model in the documentation. There are numerous other documents and tutorials here that describe this.

Regards,

Benny

michael_voss2
Participant
0 Kudos

Thanks for pointing me to these particular documents; unfortunately, they only help to a certain degree since we are using NW 7.0 and these refer to Version 7.3. Despite a lot of searching in SCN, none of the documents found helped me to solve my problem completely. Finally, I created an adaptive WebService Model like some tutorials (including those you posted the links to) suggested, and we were able to consume the web service in our development environment. But since the web service URL changes when we make the application productive, I had to find a way to change the web service endpoint at runtime. After a few hours with google, I found this document http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b2bc0932-0d01-0010-6d8e-cff1b2f22... which at least partially describes how to achieve this. Currently, my code to invoke the remote web service looks like this

// Get the mapped context element for the WebService Model node

ICheckRequestElement request = wdContext.currentCheckRequestElement();

// Fill the object tree

request.setIn0(content);

 

// Retrieve invocation URL from somewhere, e. g. a database

String invocationUrl = "http://our.server:port/path/to/service";

// Create an invocation modifier that implements doModifyInvocation() and doModifyAfterInvocation()

IWDWSInvocationModifier mod = new IWDWSInvocationModifier()

{

public void doModifyInvocation(Object port)

{

  HTTPControlInterface hcif = HTTPControlFactory.getInterface(port);

  hcif.setEndpointURL(invocationUrl);

}

public void doModifyAfterInvocation(){};

};

// Get the model object and apply the invocation modifier  

request.modelObject().wdSetInvocationModifier(mod);

// Exceute the request method... 

wdThis.wdGetCheckServiceModelCustController().executeCheckRequest();

This seems to work fine

Former Member
0 Kudos

Hi Michael,

I understand exactly the problem you are facing - I had the exact same issues a number of years ago when building a large Web Dynpro Java solution for reporting on a further large Oracle based database system.

The approach of using Adaptive Web Service models is correct, I think the thing you are missing is the logical destinations that mean you don't have to change your code when you transport through your landscape and make the applications productive.

As it's been such a long time since I did this, I'm struggling to find all of the exact information but this link might be a good starter - http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ+-+Models+-+Adaptive+Web+Service#FAQ-Models-AdaptiveW...

Essentially, what you are trying to do is remove the concrete link between your WS Model in WD4J, and instead use the dynamic Execution & MetaData destinations that are configured in Visual Admin.  Then, when you import your WS to create your model, whilst you choose a designtime WSDL, at run time this is determined dynamically based on the destinations setup and configured.  So you can have a different target in DEV, QA & Prod.

It is essentially a similar mechanism to JCo connections for RFC models, if you are familiar with them.

Hopefully this might help you get going - I'll try to find some more information from my archives!

Gareth.

michael_voss2
Participant
0 Kudos

Hi Gareth,

thanks for your hint! When creating the Adaptive Web Service Client, NWDS told me that logical destinations were an option for WSIL-enabled provider only,

so I decided to go without since the Web Service I'm consuming doesn't know a bit about that. We're using JCo destinations as well as JDBC data sources, so I'm familiar with the concept of this. The link you ported helped my find the article I linked to in my last posting, so I was able to modify the end point programatically. But now I'm going to have a closer look at that again and maybe giv the logical destinations another try.

Thanks a lot

Michael

michael_voss2
Participant
0 Kudos

Hi again!

Just a follow-up-question: When consuming a web service supporting WSIL, I'm required to set up Dynamic Proxies. My SAP Basis team does have a problem with developers using Visual Administrator even against a development application server, but I'd like to be able to test different scenarios involving those Dynamic Proxies - I guess you all know that involves making a minor change, testing, changing again and testing again for many times - and therefor be able to make these changes myself instead on having to wait for something between 15 minutes and one or two days until my basis team has made the change I suggest. How do you guys handle that in your organisation ?

Thanks

Michael

hofmann
Active Contributor
0 Kudos

How do you guys handle that in your organisation ?

By knowing what is needed instead of trying. That's why we get called senior 🙂

Well, welcome to the typical problems in a SAP landscape. In case tasking your BASIS team to set up the system to meet a specific development requirement (You: hey basis, need to do X, do your job and tell me the configuration I need) is not possible (hint: never possible), you can

a) do the "brute force" solution and figure out how to configure the system until Basis will be frustrated and give you the permissions or go with you through the configuration

b) you can use a local NetWeaver Java system to figure out the configuration on your own. You can download a Java 7.0 NW trial right here on SCN: http://www.sdn.sap.com/irj/scn/nw-downloads

Former Member
0 Kudos

How do you guys handle that in your organisation ?

Hi,

Luckily for me, on the particular engagement I faced this issue, I had budget and time from a basis colleague, who sat a desk or two away and was happy to work with me to resolve the issue.  As you say, I'd never expect developers to have access to Visual Admin however you need to collaborate with basis (just like any other member of the team) so they are making the changes with your guidance/input.

When it is something no-one in your team knows fully, I find having more than one person working on it is better anyway - two heads are often better than one!  The combination of basis and development knowledge enabled us to get it figured out and working in a pretty short time thankfully.

Gareth.

michael_voss2
Participant
0 Kudos

Hi Tobias!

Thanks for your reply. Yes, we already use local NetWeaver systems for development, but our Basis requires us to have them install these systems, since these must be integrated into our SLD. In this local installation, the Visual Administrator has been removed by them...

michael_voss2
Participant
0 Kudos

Hi Gareth!

Yes, I agree that this would be the best option. But since our basis team is rather short on personnel and time, it's very hard (read: impossible 😉 ) to get someone the moment we need a job done or a questin answered. Usually, it will take a day or two...

hofmann
Active Contributor
0 Kudos

Well, you can still try the downloadable trial version. It comes with visual administrator, so you can use that version to administer your other local NW system.

Answers (0)