Search Results

Search found 295 results on 12 pages for 'webmethod'.

Page 3/12 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • how to invoke a webservice from one container in another container in glassfish

    - by vinny
    I have webservices deployed on two containers in two separate servers A and B. A webMethod in 'Server A' needs to invoke a webmethod in 'Server B'. I have created a client stub for Sever B. Im trying to make 'Server A' use this client stub and talk to Server B. I get an exception while trying to instantiate the port object specifically at : service.getABCBeanPort(); (using JAX-WS library) Is my approach correct? Is there any better way of invoking a webservice on a remote server?

    Read the article

  • difference b/w soap web service and webservcie

    - by Praveen Prasad
    i saw that in asp.net .asmx file, we create webservices [webmethod] //method defination here now for soap webservice [webmethod] [SoapHeader(some parameters here)] //method defination here my question is what's the difference b/w both webservcies type and how to choose which service type to choose

    Read the article

  • web service exception handling

    - by Jack
    I have a WebMethod that recevives following types of parameters: [WebMethod] User(long userid,int number) When Client send parameter with different types, I have to catch this error and write to database etc.. How can I solve this? Thanks.

    Read the article

  • Calling Web Services in classic ASP

    - by cabhilash
      Last day my colleague asked me the provide her a solution to call the Web service from classic ASP. (Yes Classic ASP. still people are using this :D ) We can call web service SOAP toolkit also. But invoking the service using the XMLHTTP object was more easier & fast. To create the Service I used the normal Web Service in .Net 2.0 with [Webmethod] public class WebService1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld(string name){return name + " Pay my dues :) "; // a reminder to pay my consultation fee :D} } In Web.config add the following entry in System.web<webServices><protocols><add name="HttpGet"/><add name="HttpPost"/></protocols></webServices> Alternatively, you can enable these protocols for all Web services on the computer by editing the <protocols> section in Machine.config. The following example enables HTTP GET, HTTP POST, and also SOAP and HTTP POST from localhost: <protocols> <add name="HttpSoap"/> <add name="HttpPost"/> <add name="HttpGet"/> <add name="HttpPostLocalhost"/> <!-- Documentation enables the documentation/test pages --> <add name="Documentation"/> </protocols> By adding these entries I am enabling the HTTPGET & HTTPPOST (After .Net 1.1 by default HTTPGET & HTTPPOST is disabled because of security concerns)The .NET Framework 1.1 defines a new protocol that is named HttpPostLocalhost. By default, this new protocol is enabled. This protocol permits invoking Web services that use HTTP POST requests from applications on the same computer. This is true provided the POST URL uses http://localhost, not http://hostname. This permits Web service developers to use the HTML-based test form to invoke the Web service from the same computer where the Web service resides. Classic ASP Code to call Web service <%Option Explicit Dim objRequest, objXMLDoc, objXmlNode Dim strRet, strError, strNome Dim strName strName= "deepa" Set objRequest = Server.createobject("MSXML2.XMLHTTP") With objRequest .open "GET", "http://localhost:3106/WebService1.asmx/HelloWorld?name=" & strName, False .setRequestHeader "Content-Type", "text/xml" .setRequestHeader "SOAPAction", "http://localhost:3106/WebService1.asmx/HelloWorld" .send End With Set objXMLDoc = Server.createobject("MSXML2.DOMDocument") objXmlDoc.async = false Response.ContentType = "text/xml" Response.Write(objRequest.ResponseText) %> In Line 6 I created an MSXML XMLHTTP object. Line 9 Using the HTTPGET protocol I am openinig connection to WebService Line 10:11 – setting the Header for the service In line 15, I am getting the output from the webservice in XML Doc format & reading the responseText(line 18). In line 9 if you observe I am passing the parameter strName to the Webservice You can pass multiple parameters to the Web service by just like any other QueryString Parameters. In similar fashion you can invoke the Web service using HTTPPost. Only you have to ensure that the form contains all th required parameters for webmethod.  Happy coding !!!!!!!

    Read the article

  • Best practice when using WebMethods and session

    - by Abdel Olakara
    Hi all, I want to reduce postback in one of my application page and use ajax instead. I used the WebMethod to do so.. I have a static WebMethod that needs to access the session variables and modify. and on the client side, i am calling this method using jQuery. I tried accessing the session as follows: [WebMethod] public static void TestWebMethod() { if (HttpContext.Current.Session["pitems"] != null) { log.Debug("Using the existing list"); Product prod = (Product)HttpContext.Current.Session["pitems"]; List<Configs> confs = cart.GetConfigs(); foreach (Configs citem in confis) { log.Info(citem.Description); } } log.Info("Inside the method!"); } The values are displayed correctly and seems to work.. but i would like to know if this practice is allowed as the method is a static methods and would like to know how it will behave if multiple people access the application. I would also like to know how developers do these kind of tasks in ASP if this is not the right method. Thanks in advance for your suggestions and ideas, Abdel Olakara

    Read the article

  • Avoiding GC thrashing with WSE 3.0 MTOM service

    - by Leon Breedt
    For historical reasons, I have some WSE 3.0 web services that I cannot upgrade to WCF on the server side yet (it is also a substantial amount of work to do so). These web services are being used for file transfers from client to server, using MTOM encoding. This can also not be changed in the short term, for reasons of compatibility. Secondly, they are being called from both Java and .NET, and therefore need to be cross-platform, hence MTOM. How it works is that an "upload" WebMethod is called by the client, sending up a chunk of data at a time, since files being transferred could potentially be gigabytes in size. However, due to not being able to control parts of the stack before the WebMethod is invoked, I cannot control the memory usage patterns of the web service. The problem I am running into is for file sizes from 50MB or so onwards, performance is absolutely killed because of GC, since it appears that WSE 3.0 buffers each chunk received from the client in a new byte[] array, and by the time we've done 50MB we're spending 20-30% of time doing GC. I've played with various chunk sizes, from 16k to 2MB, with no real great difference in results. Smaller chunks are killed by the latency involved with round-tripping, and larger chunks just postpone the slowdown until GC kicks in. Any bright ideas on cutting down on the garbage created by WSE? Can I plug into the pipeline somehow and jury-rig something that has access to the client's request stream and streams it to the WebMethod? I'm aware that it is possible to "stream" responses to the client using WSE (albeit very ugly), but this problem is with requests from the client.

    Read the article

  • Dynamic WebService implementation

    - by chardex
    I have a set of different interfaces and I need to give them access via web services. I have implemented this task in .NET as follows: dynamically generated interface implementation on the IL, marked methods with WebMethod annotation, and in *.asmx handler called generated stub. More needs to be able to change the method signatures (eg change the type of certain argument or add new arguments), ie not always explicitly implement an interface, and use it as a decorator pattern. Example: interface ISomeService { void simpleMetod (String arg1); void customMetod (CusomType arg1, Integer arg2); } // Need to dynamically generate such class @WebService class SomeWebService { private ISomeService someService = new SomeServiceImpl (); @WebMethod public void simpleMethod (String arg1) { someService.simpleMethod (arg1); } @WebMethod public void customMethod (String arg1, Integer arg2) { someService.customMethod (CusomType.fromString (arg1), arg2); } } Interfaces such as ISomeService quite a lot. And manually write code like this I don't want. I work with Java recently, what technology/libraries should be used to solve such task. Thanks.

    Read the article

  • how to handle exceptions in ejb 3 based soap webservice

    - by Alexandre GUIDET
    Hi, I am currently developing an EJB3 based SOAP webservice and I wonder what are the best practices to handles uncatched exceptions and return a well formated SOAP response to the client. example: @WebMethod public SomeResponse processSomeService( @WebParam(name = "someParameters") SomeParameters someParameters) { // the EJB do something with the parameters // and retrieve a response fot the client SomeResponse theResponse = this.doSomething(someParameters); return theResponse; } Do I have to catch generic exception like: @WebMethod public SomeResponse processSomeService( @WebParam(name = "someParameters") SomeParameters someParameters) { // the EJB do something with the parameters // and retrieve a response to return to the client try { SomeResponse theResponse = this.doSomething(someParameters); } catch (Exception ex) { // log the exception logger.log(Level.SEVERE, "something is going wrong {0}", ex.getMessage()); // get a generic error response not to let the // technical reason going to the client SomeResponse theResponse = SomeResponse.createError(); } return theResponse; } Is there some kind of "best practice" in order to achieve this ? Thank you

    Read the article

  • Can't figure out jQuery ajax call parameters

    - by chad larson
    I am learning jQuery and trying the following but the parameters are so foreign to me with all the embedded quotes I think that is my problem. Can someone explain the parameters and where quotes go and possibly rewrite my parameters line? (This is a live site to see the required parms). function AirportInfo() { var divToBeWorkedOn = '#detail'; var webMethod = "'http://ws.geonames.org/citiesJSON'"; var parameters = "{'north':'44.1','south':'9.9','east':'22.4','west':'55.2','lang':'de'}"; $.ajax({ type: "POST", url: webMethod, data: parameters, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { alert(msg.d); $(divToBeWorkedOn).html(msg.d); }, error: function(xhr) { alert(xhr); alert(xhr.statusText); alert(xhr.responseText); $(divToBeWorkedOn).html("Unavailable"); } }); }

    Read the article

  • Webreference vs servicereference. Only one works ? Serialization ?

    - by phenevo
    Hi, I've got two applications. One uses webreference to my webservice, and second use servicereference to my webservice. There is metohod which I'm invoking: [WebMethod] public Car[] GetCars(string carCode) { Cars[] cars= ModelToContract.ToCars(MyFacade.GetCars(carCode); return cars; } Car has two pools: string Code {get;set;} CarType Type {get;set;} public enum CarType { Van=0, Pickup=1 } I'm debuging this webMethod, and... at the end webservice throw good collection of cars, which has one car: code="bmw",Type.Van But... Application with webrefence receives the same collection and application with servicereference gets collection, where field code is null... Invoking servicereference: MyService myService=new MyService() Cars[] cars= client.GetCars(carcode); Invoking webservice: MyService.MyServiceSoapClient client = new MyServiceS.MyServiceSoapClient(); Cars[] cars= client.GetCars(carcode);

    Read the article

  • how to pass parameter to a webservice using ksoap2?

    - by user255681
    hi there, i'm using eclipse to develop over android, i'm trying to connect to a .net webservice... when i'm calling a webmethod with no parameters it works fine... but when i come to pass a parameter to the webmethod things turn upside down... the parameter is passed as null (while debugging the webservice i discovered that) and i get a null from the webmethod in the client side code... i've been searching for a solution for a day now and all that i can interpreter is that people keep talking about encoding styles and such stuff.... i've tried it all but in vain. i'm using ksoap2 version 2.3 with the following code package com.examples.hello; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloActivity extends Activity { /** Called when the activity is first created. */ private static final String SOAP_ACTION = "http://Innovation/HRService/stringBs"; private static final String METHOD_NAME = "stringBs"; private static final String NAMESPACE = "http://Innovation/HRService/"; private static final String URL = "http://196.205.5.170/mdl/hrservice.asmx"; TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tv=(TextView)findViewById(R.id.text1); call(); } public void call() { try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //PropertyInfo PI = new PropertyInfo(); //request.addProperty("a", "myprop"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); envelope.dotNet=true; envelope.encodingStyle = SoapSerializationEnvelope.XSD; HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION, envelope); Object result = (Object)envelope.getResponse(); String results = result.toString(); tv.setText( ""+results); } catch (Exception e) { tv.setText(e.getMessage()); } } }

    Read the article

  • Can't transfer list<T> to web service?

    - by iTayb
    I have the same classes on my server and on my web service. I have the following WebMethod: [WebMethod] public int CreateOrder(List<Purchase> p, string username) { o.Add(new Order(p,username)); return o.Count; } However the following code, run at server: protected void CartRepeater_ItemCommand(object source, RepeaterCommandEventArgs e) { List<Purchase> l = ((List<Purchase>)Session["Cart"]); if (e.CommandName == "Order") { localhost.ValidateService WS = new localhost.ValidateService(); WS.CreateOrder(l, Session["username"].ToString()); } } gives the following error: Argument '1': cannot convert from 'System.Collections.Generic.List<Purchase>' to 'localhost.Purchase[]'. How can I transfer the list<Purchase> object to the web service? Thank you very much.

    Read the article

  • Webreference vs servicereference. Why ony one works ?

    - by phenevo
    Hi, I've got two applications. One uses webreference to my webservice, and second use servicereference to my webservice. There is metohod which I'm invoking: [WebMethod] public Car[] GetCars(string carCode) { Cars[] cars= ModelToContract.ToCars(MyFacade.GetCars(carCode); return cars; } Car has two pools: string Code {get;set;} CarType Type {get;set;} public enum CarType { Van=0, Pickup=1 } I'm debuging this webMethod, and... at the end webservice throw good collection of cars, which has one car: code="bmw",Type.Van But... Application with webrefence receives the same collection and application with servicereference gets collection, where field code is null... Invoking servicereference: MyService myService=new MyService() Cars[] cars= client.GetCars(carcode); Invoking webservice: MyService.MyServiceSoapClient client = new MyServiceS.MyServiceSoapClient(); Cars[] cars= client.GetCars(carcode);

    Read the article

  • Controller getting NULL value?

    - by RSolberg
    I'm trying to make a call to a controller via jQuery $.post, but the parameter for my controller method keeps getting a NULL value despite it appearing to be setup similar to other controller methods. CONTROLLER [AcceptVerbs(HttpVerbs.Post)] public ActionResult SearchWeatherLocations(string searchFor) { //Do Some Magic } GLOBAL.ASAX routes.MapRoute("SearchWeatherLocations", "Home/SearchWeatherLocations/{searchFor}", new { controller = "Home", action = "SearchWeatherLocations" }); jQuery Call From View <script type="text/javascript" language="javascript"> $(document).ready(function () { GetWeatherLocations("seat"); }); function GetWeatherLocations(sSearchFor) { var divToBeWorkedOn = '#locations'; var webMethod = '<%= Url.Action("SearchWeatherLocations", "Home") %>/'; var url = webMethod + sSearchFor; $.post(url, function (data) { $('#locations').children().remove(); for (var count in data) { $('#locations').append("<li>" + data[count].LocationName + "&nbsp;(" + data[count].LocationCode + ")</li>"); } }); } </script>

    Read the article

  • call my web services from other app with javascript?

    - by Dejan.S
    Hi. I got .asmx a web service on my app. I need to call a method from an other app to get statistics from my app. I need it to return XML. the call to the webmethod is done with javascript soap. There is a default hellow world webmethod and calling that work but it seem that when i try to call a method where i need to pass parameters and it need to execute code it wont work and just return my error message. any ideas on what can be wrong. am I using the wrong web method?

    Read the article

  • Multiple webservice calls

    - by Mujtaba Hassan
    I have a webservice (ASP.NET) deployed on a webfarm. A client application consumes it on daily basis. The problem is that some of its calls are duplicated (with difference of milliseconds). For example I have a function Foo(string a,string b). The client app calls this webmethod as Foo('test1','test2') once but my log shows that it is being called twice or sometimes 3 or 4 times randomly. Is this anything wrong with the webfarm or the code? Note that the webmethod has simple straighfarward insert and update statements.

    Read the article

  • Sql CLR calling webservice throws exception

    - by TonyP
    I have clr stored procedure that calls a Webservice method. Webmethod in turn call a com object .. and do some processing on a remote Unix server. When I invoke webmethod by it self it works fine. But when called from the CLR I get the following exception.. What am I doing wrong ? Msg 6522, Level 16, State 1, Procedure PrintOa, Line 0 A .NET Framework error occurred during execution of user-defined routine or aggregate "PrintOa": System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host. The protected resources (only available with full trust) were: All The demanded resources were: Synchronization System.Security.HostProtectionException: at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) at System.Diagnostics.TypedElement.BaseGetRuntimeObject() at System.Diagnostics.ListenerElement.GetRuntimeObject() at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() at System.Diagnostics.TraceInternal.get_Listeners() at System.Diagnostics.TraceInternal.WriteLine(Object value) at System.Diagnostics.Debug.WriteLine(Object value) at BaaNOA.PrintOA(String trid)

    Read the article

  • C# where keyword

    - by Carra
    Our Indian overseas developers have written the following piece of code (C# 2.0): public abstract class ObjectMapperBase<T> where T : new() { internal abstract bool UpdateObject(T plainObjectOrginal, T plainObjectNew, WebMethod fwm, IDbTransaction transaction); } Inheritor example: public abstract class OracleObjectMapperBase<T> : ObjectMapperBase<T> where T : new() { internal override bool UpdateObject(T plainObjectOrginal, T plainObjectNew, WebMethod fwm, IDbTransaction transaction) { //Fancy Reflection code } } I've never seen the where keyword before after the class name. What does this do?

    Read the article

  • Programmatically changing code files

    - by Carra
    I'm changing our webservices to an async model. And for that I have to change over a hundred methods. Doing it manually is one (unappealing) option. Is there no way to programmatically parse & change multiple functions/code files? Example: [Webmethod] public void MyWebservice (string parameter1, string parameter2, string parameter3) { //Logic here } And change this to: public void InternalMyWebservice (string parameter1, string parameter2, string parameter3, AsyncCallback callback) { //Logic here } [Webmethod] public void BeginMyWebservice (string parameter1, string parameter2, string parameter3, AsyncCallback callback, object asyncState) { //Queue InternalMyWebservice in a threadpool } public void EndMyWebservice(IAsyncResult asyncResult) { //Set return values } It's basically the same thing I have to do for each webservice. Change the name to "InternalX", add a parameter and create the begin & end method.

    Read the article

  • Problems to create webservice jax-ws on WebSphere 8.5

    - by Napalm
    I'm using Eclipse Juno to create jax-ws webservice on WebSphere® Application Server V8.5 Tools. The WebService sometimes are created but most often he fails to create wsdl. For exemplify, i try to create a simple webservice named Web: import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class Web { @WebMethod public String getName() { return "myName"; } } After deploy this webservice and viewing WebSphere administration page not exists any service named WebService. I tried too access the generated WebSphere wsdl from the url localhost:9080/MyProject/WebService/WebService.wsdl but this not exists. My project have a configured MANIFEST file that contains: Manifest-Version: 1.0 UseWSFEP61ScanPolicy: true I'm actually using servlet 3.0 but tried with 2.3. Anyone can help me to do WebSphere approprieate scan annotations of ws-jax and create wsdl on server?

    Read the article

  • ASP.NET web services leak memory when (de)serializing disposable objects?

    - by Serilla
    In the following two cases, if Customer is disposable (implementing IDisposable), I believe it will not be disposed by ASP.NET, potentially being the cause of a memory leak: [WebMethod] public Customer FetchCustomer(int id) { return new Customer(id); } [WebMethod] public void SaveCustomer(Customer value) { // save it } This flaw applies to any IDisposable object. So returning a DataSet from a ASP.NET web service, for example, will also result in a memory leak - the DataSet will not be disposed. In my case, Customer opened a database connection which was cleaned up in Dispose - except Dispose was never called resulting in loads of unclosed database connections. I realise there a whole bunch of bad practices being followed here (its only an example anyway), but the point is that ASP.NET - the (de)serializer - is responsible for disposing these objects, so why doesn't it? This is an issue I was aware of for a while, but never got to the bottom of. I'm hoping somebody can confirm what I have found, and perhaps explain if there is a way of dealing with it.

    Read the article

  • Two methods with different signatures, jquery is not calling correct method

    - by Lee
    There are two methods GetUserAssignedSystems() and GetUserAssignedSystems(string Id) These methods act very differently from each other. The problem is, when I want to call GetUserAssignedSystems(string Id), the parameter-less method is called. Here are the methods: [WebMethod] [ScriptMethod] public IEnumerable GetUserAssignedSystems(string cacId) { return Data.UserManager.GetUserAssingedSystems(cacId); } [WebMethod] [ScriptMethod] public IEnumerable GetUserAssignedSystems() { //do something else } Here is the jquery making the call: CallMfttService("ServiceLayer/UserManager.asmx/GetUserAssignedSystems", "{'cacId':'" + $('#EditUserCacId').val() + "'}", function(result) { for (var userSystem in result.d) { $('input[UserSystemID=' + result.d[userSystem] + ']').attr('checked', 'true'); } }); Any ideas why this method is being ignored?

    Read the article

  • handle an arrray posted with $.ajax (jquery) to a webservice

    - by burktelefon
    I'm trying to post data to a webservice (asp.net 3.5), like below (two variants, one commented): var array = [3, 2, 5, 1, 7]; var jsonString = JSON.stringify(array); //var jsonString = '{ "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021" }, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] }' $.ajax({ type: "POST", url: "WebService2.asmx/AddRoute", data: jsonString, contentType: "application/json; charset=utf-8", dataType: "json", processData: "false", error: function(msg) { alert('error' + msg.toString); } }); So I need a matching webmethod to recieve it. Something like this: [WebMethod] public string AddRoute(/* xxx */) { //handle data } Could someone please elaborate on how I can fetch the data, where I've typed "xxx"? I would have thought "int[] array" would do the trick, but it's not working. Any help would be greatly appreciated :)

    Read the article

  • display result in status after it post

    - by nisardotnet
    my question is continuation of what i have posted here i want to know how to display a result status based on my return result from Web Method here is my post code: beforeSubmit: function(data) { var myData = { "firstName": escape($('#txtFirstName').val()), "lastName": escape($('#txtLastName').val()) }; $.ajax(<br> { type: "POST", url: "VisitorWS.asmx/AddVisitors", data: JSON.stringify(myData), contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { $("#status").fadeTo(500, 1, function() { $(this).html("You are now registered!").fadeTo(5000, 0); }) }, error: function(data) { $("#status").fadeTo(5000, 1, function() { $(this).html("Failed!").fadeTo(5000, 0); }) } }); WebMethod [WebMethod] public bool AddVisitors(string firstName, string lastName) { if (firstName == "test") { return true; } return false; } so based on true or false i want to display a message on the client side.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >