Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Consuming a Webservice is extremly slow

Guest
Mar 05, 2009 Mar 05, 2009
Hi
I would like to use a Webservice to communicate with a server. For test purposes I wrote a small java webservice which adds to numbers using the following 2 classes.

== Class Calculator ==
package de.theserverside.webservice.service;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style=Style.RPC)
public class Calculator
{
public long addValues(int val1, int val2) {
return val1 + val2;
}
}

== Class CalculatorServer ==
package de.theserverside.webservice.service;
import javax.xml.ws.Endpoint;
import de.theserverside.webservice.service.Calculator;
public class CalculatorServer {
public static void main (String args[]) {
Calculator server = new Calculator();
Endpoint endpoint =Endpoint.publish(" http://<IP Adresse>/calculator?wsdl", server);
}
}


In Coldfusion I tested both methods to consume this Webservice:

<cfinvoke webservice=" http://<IP Adresse>/calculator?wsdl" method="addValues" returnvariable="aString">
<cfinvokeargument name="arg0" value="1"/>
<cfinvokeargument name="arg1" value="6"/>
</cfinvoke>
<cfoutput>#aString#</cfoutput>

== mit cfskript ==
<cfscript>
ws = createObject("webservice"," http://<IP Adresse>/calculator?wsdl");
xlatstring = ws.addValues(2,9);
</cfscript>
<cfoutput>#xlatstring#</cfoutput>


The Webservice works with both methods but it takes between 5 and 6 Minutes to get a result.
I also wrote a java client to test the webservice which returned the result within 1 second.

Whats the problem here with CF?

I am using CF 8
TOPICS
Advanced techniques
616
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 05, 2009 Mar 05, 2009
I found a third way to call a webservice using chttp. But now I have the problem that I cant pass paramaters to my method.
I wrote a simple hello world method without any paramater and it worked within 1 sec.

When I try to use the addValues method I get this Error:
ns2:Serverjava.lang.IllegalArgumentException

here is the CF Code
<cfsavecontent variable="soap">
<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser=" http://service.webservice.theserverside.de/">
<soapenv:Header/>
<soapenv:Body>
<ser:addValues>
<arg0>6</arg0>
<arg1>34</arg1>
</ser:addValues>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>


<cfhttp url=" http://<IP>/calculator?wsdl" method="post">
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="">
<cfhttpparam type="header" name="content-length" value="#len(soap)#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" name="message" value="#trim(soap)#">
</cfhttp>

<!--- Dump out a nice representation of the SOAP response --->
<cfoutput>#cfhttp.FileContent#</cfoutput>
<cfdump var="#xmlParse(cfhttp.FileContent)#">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 24, 2009 Mar 24, 2009
LATEST
anyone have an idea how i can pass parameters to a java webservice?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources