How to Rapidly Implement a Web Service

Not sure if you guys are familiar with Integration Server 4.6, but I just wanted to give you the cliff notes on how easy it is to create a WSDL document from a flow and to create a flow connector from a WSDL document:

How to turn an existing service into a Web Service

  1. Select the service you want to create a Web Service from and choose “Generate WSD…” from the “Compose” menu.

  2. When the option screen comes up, select your options and click ok (the default values are fine).

  3. Select a location to save the WSDL file

How to connect to a Web Service

  1. Click the “New…” button on the menu toolbar and select “Web Service Connector”

  2. Choose a folder where you want the Web Service to be saved

  3. Choose a WSDL file (note that you can paste in a URL to a WSDL file!) and click OK to generate the Connector

Hi…Anyone created a Web Service from a webMethods service that returns a file (any files like .pdf, .txt, .html, etc). My understanding from the documentation is that the webMethods support for Web Service creation expects an XML document (or String) as the output of the service, whether we use SOAP message or HTTP POST as the transport protocol. Also I could not find any supporting services which allows to add an attachment to a SOAP message (though there are services to add Header and Body).
My requirement is to create a Web Service from a webMethods Service which returns a file (it can be .pdf, .txt or .html). Is there a way in webMethods?

The are two major types of SOAP interaction that wM IS supports: SOAP-RPC and SOAP-MSG.

With SOAP-RPC the focus is on invoking a particular service with specific input and output parameters. The wM SOAP-RPC processor does the de-enveloping/enveloping and parameter marshalling work for you. You don’t have to deal with SOAP things at all within your service.

With SOAP-MSG there is a bit more work you have to do. The SOAP processor, either the built-in processor or your custom made processor, expects SOAP docs as input and output. This means you get to pull the SOAP body or bodies from the inbound doc, and generate the outboud SOAP doc, putting your content in the appropriate body/bodies.

A SOAP body can hold anything. While not referred to as an attachment per se, you can place .pdf, .txt, .html, etc. data in the body. You need to set the appropriate tags so that the receiving system knows what it is getting.

The webMethods SOAP Programming Guide is a good source of information. Focus on the SOAP-MSG section. It should provide help for what you’re trying to do.

HTH.

If there isn’t some exact SOAP message format that you need to create, I would still use SOAP-RPC.

The outputs of my service would look like:

Record fileDescriptor
String fileName
String fileType
String encoding { “String”, “Base64” }
Object data

Inside my service I would call com.wm.util.Base64 .encode(byte) or com.wm.util.Base64 .encodeUTF8(String) if I started with a Java String.

The callers of this service would have to know how to fill in the parameters (i.e. they would have to know how to base64 encode and decode).

HTH,
Fred

Thanks to Rob and Fred for your valuable inputs…
I have done it with SOAP-RPC and Base64 encoding. It works…
I used the services under pub.string for Base64 encoding.

Is it not possible to transport a file without base64 encoding?

By the way, Fred, where can I find the API methods you mentioned for Base64 encoding? I could not find a package named com.wm.util.Base64 in the API documentation for webMethods 4.6.

Thanks…

ooops. I thought com.wm.util.Base64 was a publically documented class in client.jar. Never mind.

There isn’t a good reason to call the underlying Java class when there is a service that surfaces a public way to access the operation. The overhead of a service call will be offset by the amount of time it takes to base64 encode a reasonable sized file.

Note that most binary files are base64 encoded in mime messages, so all in all it is a reasonable way to encode.

There is a hexBinary type in Soap RPC, but that creates bigger results than base64.

Hi,

I am trying to invoke a WebService. I have successfully created the WebService connector using the WSDL at the URL - “http://weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl”. When I’m trying to test the Server function NDFDgenByDay()/NDFDgen(), I’m getting the following error - java.net.ConnectException: Operation timed out: connect.

I have even set the watt.net.timeout=600, but still Im getting the same exception.

I have provided all the necessary inputs and even the host/function names are valid.
You can check the required inputs to the connector on the webpage - “http://weather.gov/xml/”.

Why am I getting this error when Im trying to test the webservice connector. I’ve uploaded the package also for your reference.

Environment is: IS 6.1 , windows XP, JVM 1.4.1

Thanks,
Sachin

package
Sachin.zip (15.9 k)

Something is preventing you from getting to the weather.gov server. I just tried the same from my location by running the connector stand-alone and it worked fine.

Did you hit the weather.gov web site directly to create your connector, or did you get the WSDL file from somewhere else?

Mark,

I have created the webservice connector using the WSDL file directly from the weather.gov web site.

Did you try testing using the package that I have attached in the query.

If it is working fine for you then what can be the problem when I’m trying to access the same. Can it be because of some firewall setting that needs to be done or some Sevice Pack/fixes that I need to install (I already have FP1 and FP2 installed).

Regards,
Sachin

Sachin,

I didn’t use your package. I just created the connector directly from the URI of the WSDL you referenced.

Have you tried running the connector stand-alone yet?

If it fails stand-alone, it may be a firewall issue. Do you have an internal web service you can hit to verify this?

-Mark