Reentrant web method VIs
The only mention I've found anywhere about using multiple web method instances is in this post:
"If the web method VI is marked reentrant, than multiple requests can be
handled concurrently (and your application logic should account for that
fact). If the web method is not marked reentrant, than only one
request at a time can call the VI and subsequent request threads will
block waiting to be able to call your VI." darenw, talking about web services in 8.6.
This makes plenty of sense and is what I expect. However, I find this not to be the case [using 2010 SP1]. My example is very simple:
Make the web method VI consist only of a "Wait (ms)" function set to wait for 10000 ms [10 s]. Check the "reentrant execution" box in the VI Properties dialog. Add the web method VI to a RESTful Web Service build spec and build and deploy. Then type the URL for the web method into two browser windows and send both queries at close to the same time. The first window will take 10s waiting for a response before finishing, as expected. The second window will take 20s--apparently the second instance of the web method VI does not start running until the first instance is completed.
Not only does this conflict the the quote above, but it's a poor behavior for web services in general [and it's fatal to my application in particular]. [To be complete I should add that running the web method VI in multiple parallel instances in the same container VI results in a 10s run as expected].
Is this a bug or what?
[this is an appendage to this ongoing discussion but is distinct enough from the original topic that I decided it should get its own--I apologize for the clutter if that was the wrong decision]
Just some more clarification
I did a similar test to pltrogon using LabVIEW 2010 SP1 on Windows Server 2008 R2 with a VI which waits 10 seconds and then returns the current time (hour/minutes/seconds). This web service VI is set to be re-entrant with the 'preallocate clone for each instant' option. It turns out the browser you use makes the difference, as seen from the time stamps returned:
Internet Explorer 9 executes the requests in parallel so multiple instances run at the same time. Five concurrent requests cause no difficulties.
Firefox 5 executes the requests in series. That is, it sends the second request as soon as the response to the first one has arrived.
That's why getting the page on two different computers shows the expected re-entrant execution.
As a check, if I set the VI to be not re-entrant, only one instance of the VI runs at the time, as seen from the times returned in the browser window.
My conclusion:
LabVIEW (2010 SP 1) is doing what is expected, you just have to use a client which sends multiple requests to the same page at the same time, and doesn't let the second request wait until the first request is finished.
Similar Messages
-
Using global in web method vis
I am using labview 8.6 . I have a problem in using Globals in my web method vis. If i directly read the data it works fine but if i use global it doesnt read data.
Hello Jawad,
Thanks for sharing your issue. There could be more than one reason why your global variables are not behaving as you would like them to. I would encourage you to read through the following online article to get started with troubleshooting: <http://digital.ni.com/public.nsf/allkb/4F3CC921B4179F9F86256A3B0045CE2D?OpenDocument>. Could you also share more about your application and what your ultimate goal is with the global variable?
If you are interested in web services, I would recommend reading the articles at the following links:
http://zone.ni.com/devzone/cda/tut/p/id/7350
http://zone.ni.com/reference/en-XX/help/371361E-01/lvhowto/build_web_service/
http://zone.ni.com/devzone/cda/tut/p/id/7747
If you have any questions about web services, please feel free to ask.
Regards,
Dan Richards
Dan Richards
Certified LabVIEW Developer -
Can webservice in l.v 8.6 support all time running Web Method vis
I have to call some user events in my project so i am using while loops in which i use event case that handles user events. When i make this vi web method vi and when pass url in my webbrowser it stucks. So can i handle or use while loops in webmethod vi.
You do not want to use an unterminated while loop in your web method VIs, because it won't return any data and your web browser will get "stuck" waiting for the VI to complete. Instead you should have a separate VI, in your application, that runs your while loop continuously. When the web method executes it should query the while loop for the current data and return immediately, leaving your while loop running independently in the background.
-
Dynamic IP for web service VIs?
Hi,
I use the LabVIEW Web Service Import Wizard to build web service VIs. I was wondering if there is any method to dynamically specify the IP address of a web service server.
In our application development, usually we would setup an internal test server running web services. Once the development is finished, we would deploy the server with a new IP address. We'd then need to import the web services again and change the VI links in order for the new program to work. It would be nice if we can just change the server IP address instead.
Best Regards,
Chienwei
CWTHello ! Has anyone found a working solution to this problem yet ? The URL can be changed just like Joe explains, but at least for me this is not a solution. My application is Still trying to connect to the IP Address of the PC from where the Web Service methods were originally imported and it doesn't make difference if I feed another IP address into the url.
It seems the fixed IP Address was stored somehow directly into the WebServiceInterface.dll itself, when the Web Service was first imported.
I guess one workaround would be to install the LabVIEW into the same PC where the Web Service is located and import the Web Service there using "localhost" instead of IP Address. But this helps (? - haven't tried yet) only if I run my application on the server computers. If I install my application on some client PC the application is probably trying to connect to "localhost" and it won't work.
I wonder if this annoying problem has been fixed in 2010, or if there's another workaround ?
Best regards,
Cerati -
Return multiple values from a web method??
Hi,
I am wondering if it's possible for a web method to return multiple values to a client. I know each web method can return only one value of a given data type. I am looking for something like ref or out keyword in C#. If it's not available, is there any workaround? Thanks.
RegardsJava web service endpoints can return multiple values by using the javax.xml.rpc.holders classes. The following post might help:
http://forum.java.sun.com/thread.jspa?threadID=684916
If you'll be returning lots of values, it might be worth considering a document-style implementation rather than RPC-style. -
Calling a web service from BPEL using java web methods
Hello everyone,
I have an application my BPEL process should connect to. The application which is a web service needs to be called using pre defined web methods defined in java from my bpel process using Jdev 10g. Any suggestions in how I can go about doing that? Please I really need helpHi there,
If you have defined already your partner links to the service you can use the BPEL API to invoke them from RMI. See this blog entry
http://technology.amis.nl/2006/06/08/oracle-bpel-pm-invoking-a-remote-bpel-service-from-java-using-rmi/
It'd be also good if you post the question on the bpel forum BPEL
Thanks,
JC -
Error occurs when i try to install a built application containing Web services VIs
Hello,
at the moment i am trying to create and install a built application containing a Web server and Web services VIs. I did the steps as described here: http://www.ni.com/white-paper/7747/en#toc13
But when I install my application on the target PC the following error occurs after the installation:
Error2: Failed to perform action
"[LV2011RTEDIR]LVWS\NILVWSPostInstallerScript.exe"
"[ProgramFilesFolder]DeployWebServices\Webservice.lvws"
What did I do wrong? The project example is attached
Development system: LV2011 SP1, WIn7
Target PC: Win7, no LabVIEW, but ALL possible additional installer/run-times installed
Thanks,
Elmar
Certified LabVIEW Developer
www.merecs.de
Attachments:
Deploy Web Services.zip 20 KBHi,
long time ago, but I can remember. You have to copy a folder.
e.g. I have the file in C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2013\LVWS , but there is no LVWS folder in \Shared\LabVIEW Run-Time\2012
(I have a new computer, and for some reason I'm also missing the file in the LV2012 folder now.)
Try to copy from another version to 2012 U(or download my fzip). I also don't now, why it is missing. Maybe something during the LV2012 installion was wrong.
Hope I could help,
Elmar, CLD
Certified LabVIEW Developer
www.merecs.de
Attachments:
LVWS.zip 688 KB -
Reading a file and caching in web service before a web method is called
Hi All,
I developed a webservice with some web methods. I need to validate the licencing for those web methods. And my licensing details will be available in a file. Instead of reading the licencing file for every web method invocation I want the licensing file should be read only once and those details should be cached. So that for every method invocation I will use the cached licensing details. I am using Axis 1.0. How can I achieve this functionality. Please help me in solving this problem.
Thanks in Advance,
NareshThe program needs to read a text file.
I made sure that the text does not have space between the lines.
I wanted to have a String object with all the data (lines).
So I used a StringBuffer (append) to collect all the data lines.
I wanted to read each line of the file and assign them to my StringBuffer, using the built-in nextLine() method of the Scanner class and using the for loop.
I already tried printing out each line as I read it (using the code below). Even though the program showed each line like it should, it still said "java.util.NoSuchElementException: No line found" at the end.
//read a line of characters of the file
line = file.nextLine();
while (line != null) { //file is terminated by a null
System.out.println(line);
sb.append(line);
line = file.nextLine();
} -
DTD generation for IDOC- XI- Web-Method(SOAP)
Hi All,
Our web method team wants DTD from XI to design there development.
I can provide XML structure but I do not know how to generate DTD file from XI.
Also I am trying to generate DTD following site : http://www.hitsw.com/xml_utilites/ But web-method team saying there is no Root node in above generated DTD.
Please guide me how to generate DTD from XI?
RegardsBhavesh,
I am working on a MDM(FILE)-XI-IDOC interface. I need to have the IDOC structure for my file structure. I have exported XSD from the IDOC and created an external definition file and using it.
Otherwise, can I create a DTD file out of IDOC and import that into any data type? I created the DTD for the IDOC in WE60 and tried to import that into XI data type which is giving PARSER ERROR.
Do you have any idea how to create a DTD file from a XSD file as you mentioned in this message?
Thanks
Kalyan -
How is call web method in application?.
Hi,
I have created java web application(Web Service).
I want to call the setName() method in java application(GUI).
how is call web method in application?.
package sv;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService()
public class MyService {
@WebMethod(operationName = "setName")
public String setName(@WebParam(name = "name")
String name) {
return "my string is "+ name;
}The model layer should never depend on a specific view layer - this breaks reusability.
What you need to do is expose a service method on your AM. Then your view can call this method and pass a parameter into the model layer. -
JAX-WS client error when calling web method
My JAX-WS client is getting the following error when calling a web method:
Exception in thread "main" javax.xml.ws.WebServiceException:
No Content-type in the header!
I'm using Eclipse as my development environment. I use the CXF facet to generate a WSDL from Java code. I then use the New -> Web Service Client to generate client side code from the WSDL.
The following fully describes my environment:
Windows XP
JDK 1.6.0_22
Java EE 6
Eclipse Helios
Apache CXF 2.3.0 (runtime)
Tomcat 6.0
I have found several post on the net that describe this problem and a solution for JBoss, but I have been unable to find anything that addresses this error on Tomcat.
I can provide source code if needed. The app is a simple Hello World web service. I'm using it to try and get familiar with developing web services with all the components listed above.
ThanksHi Anders,
The resolution of the crossdomain problem is not to store an cross-domain-policy file at the [SAP] webservice side; but instead it needs to be done at the (every...) webservice client. In case the client is an IIS based webapplication (and thus the ultimate end-users are accessing it via their browser), this is not such an issue. It there is sufficient to put an crossdomain.xml policy file in the IIS main virtual root of your 'client' .net webapplication (c:\inetpub\wwwroot). It also can be required or at least helpful to put a clientaccesspolicy.xml file; both at the main virtual root and in the virtual root of the specific webapplication
In case of SharePoint application, the crossdomain.xml file must be stored in the WSS virtual root of that site; c:\inetpub\wwwroot\wss\virtualdirectories\<your SharePoint webapp>
Best regards, William. -
WSDL for web method with parameters from different namespaces
I'm trying to create a web service that exposes a method that accepts a JAXB XML object and a timestamp as parameters and returns another JAXB XML object. I've tried to follow the contract-first method by creating the schema and WSDLs first. I've created the schemas for the XML and deployed them on a web server and I've written the following WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://bar.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyWebService"
xmlns:ns0="http://foo.org/Transaction"
xmlns:ns1="http://bar.org/TransactionResponse"
targetNamespace="http://bar.org">
<!-- T Y P E S -->
<wsdl:types>
<xsd:schema targetNamespace="http://bar.org"
xmlns:ns0="http://foo.org/Transaction"
xmlns:ns1="http://bar.org/TransactionResponse"
xmlns="http://bar.org">
<xsd:import namespace="http://foo.org/Transaction" schemaLocation="http://myHost/schemas/Transaction.xsd"/>
<xsd:import namespace="http://bar.org/TransactionResponse" schemaLocation="http://myHost/schemas/TransactionResponse.xsd"/>
<xsd:element name="ProcessTransactionRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ns0:Transaction"/>
<xsd:element name="TransactionTime" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<!-- M E S S A G E S -->
<wsdl:message name="ProcessTransactionRequest">
<wsdl:part element="tns:ProcessTransactionRequest" name="parameters" />
</wsdl:message>
<wsdl:message name="ProcessTransactionResponse">
<wsdl:part element="ns1:TransactionResponse" name="parameters" />
</wsdl:message>
<!-- P O R T T Y P E -->
<wsdl:portType name="MyWebServicePortType">
<wsdl:operation name="ProcessTransaction">
<wsdl:input message="tns:ProcessTransactionRequest" />
<wsdl:output message="tns:ProcessTransactionResponse" />
</wsdl:operation>
</wsdl:portType>
<!-- B I N D I N G -->
<wsdl:binding name="MyWebServiceSOAP" type="tns:MyWebServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ProcessTransaction">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- S E R V I C E -->
<wsdl:service name="MyWebService">
<wsdl:port binding="tns:MyWebServiceSOAP" name="MyWebServiceSOAP">
<soap:address location="http://www.example.org/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>However when I run the WsImport tool bundled with JAX-WS RI 2.1.1, I get the following interface:
public interface MyWebServicePortType {
* @param parameters
* @return
* returns org.bar.transactionresponse.TransactionResponse
@WebMethod(operationName = "ProcessTransaction")
@WebResult(name = "TransactionResponse", targetNamespace = "http://bar.org/TransactionResponse", partName = "parameters")
public TransactionResponse processTransaction(
@WebParam(name = "ProcessTransactionRequest", targetNamespace = "http://bar.org", partName = "parameters")
ProcessTransactionRequest parameters);
}Which is workable, but I was wondering how to modify the WSDL to get a web method signature similar to:
public TransactionResponse processTransaction(
@WebParam(name = "Transaction", targetNamespace = "http://foo.org/Transaction", partName = "transaction")
Transaction transaction,
@WebParam(name = "TransactionTime", targetNamespace = "http://bar.org", partName = "transactionTime")
XMLGregorianCalendar transactionTime);With two parameters in the parameter list instead of one. Is there a way to do this?Try changing the <xsd:element name="ProcessTransactionRequest"> element name to: <xsd:element name="ProcessTransaction"> and update the reference to it in the <wsdl:message name="ProcessTransactionRequest"> message.
In order to use wrapper style, your WSDL needs to have the following characteristics:
1) The operation's input and output messages (if present) each contain a single part
2) The input message part refers to a global element declaration whose localname is equal to the operation name
3) The output message refers to a global element declaration
4) The elements referred to by the input and output message parts (henceforth referred to as wrapper elements) are both complex types defined using the xsd:sequence compositor
5 The wrapper elements only contain child elements, they must not contain other structures such as wildcards... -
Implementing several web-methods in one BPEL process
Hi
We are trying to implement an integration system with help of BPEL PM, which must provide its interface for another system as a single web-service with different web-methods (operations).
By now we were able to provide only one operation per web-service, as default BPEL behavior.
How is it possible to make a single web service "entry point" to our different BPEL processes as a web-service with different methods?
WBR, Serg.You must start the (async) process with a pick-activity (not the default receive), and check it to Create Instance.
I just made some test-processes (soon to be more like production), so my finding are not quite mature, but here they are:
You now need to add your flavour of operations (which I assume have to be async, I've not tested sync). The operations are simply added to the process wsdl-file, typically within the existing portType.
To start with I would suggest that you use the same portType and the same message name for all operations.
You soon discover the need for separate responses as well, again its designing it and code the wsdl-file.
When you get going you can try to differentiate the message, it's all about coding the wsdl-file.
Adding portTypes looks a bit more complex, but it seems to work (but does it do you any good?).
If you add portTypes, remember to add a plnk:partnerLinkType as well.
So: Multi-operation BPEL WS here we come!
CadB -
Unable to access Web Method after deploying into the server
Hi,
I'm Unable to access Web method after deploying into the server.
My Web method is
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json )]
public object getOwners()
DataTable dt = _qbObj.returnDDLData("employeedetails", "EmpID", "EmpFirstName");
if (dt == null)
return new { Result = "Error", Options = "Error getting data" };
string[] strAttributes = { "ID", "Name" };
string[] strColName = { "EmpID", "EmpFirstName" };
List<SolOwners> lstObject = convertToList(dt, strAttributes, strColName, new SolOwners());
var owners = lstObject.Select(c => new { DisplayText = c.Name, Value = c.ID });
return new { Result = "OK", Options = owners };
When I.m accessing that method after deploying into server, I got following error.
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: <>f__AnonymousType9`2[System.String,System.Collections.Generic.IEnumerable`1[<>f__AnonymousTypea`2[System.String,System.String]]] cannot be serialized because it does not have a parameterless constructor.
at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
at System.Xml.Serialization.XmlSerializationWriter.CreateUnknownTypeException(Type type)
at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write71_anyType(Object o)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()Please help me to solve that issue.Thank you.Hi Vani,
What project are you developing? According to your code looks like an Asp.Net application? Am i right?
If so , please repost in ASP.Net Forum
http://forums.asp.net for more efficient responses.
This forum is discuss problems of C# development.
Have a nice day!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi All,
I know this question is not related to PI. For one of your presentation between sap pi and webmethods I am looking for this. If any body is having Web methods Trading Networks system, can you please give me a screen shot or a tutorial for one of the interface end to end.
Thanks for all your time.
ChenAs you rightly judged, there is nothing much available in on SDN about Webmethods Trading Network. The only point where it was discussed was when there was anything about SAP BC, the predecessor of XI. I would suggest you to try WebMethods forum.
http://www.wmusers.com/forum/archive/index.php
Regards,
Prateek
Maybe you are looking for
-
Can I create a 2nd iTunes account on one PC that caters for two seperate devices for different people?
-
The Apple shop installed a German version of iTunes, how can I convert it to an English version - or would it be better to delete the German version and download a new iTunes?
-
Planning for 3shift production
hi, my client doing planning in legacy system for 3 shift production.he makes plan two days before for a day production. planning sheet contains shift detail,time interval for prodn, material number,planned qty. Eg, 1st shift- 7.00am to 10.00am- 'X'm
-
Hi, Could you please clarify me the following 1) In which transaction code we can find the all the segements assigned to a MEASSAGE type. 2) In which transaction code we can find all the fields available under the Segement type. 3) where we can see a
-
Clock at 12:00 am. Music wont play
When I get in the car in the morning and turn on my iPod, the Clock comes up with 12:00 am and music will not play. The menus all function and it looks like it is playing but no sound comes out. If I do a reset, the clock goes back to the correct tim