Allow Client Pass My Object Through Webservice?
Nov 12, 2010
I want to write a webservice, and in one of its methods, I want user to pass one my object's instance as parameter. It will greatly reduces number of parameters, and help user call this method more effectively. I create some class, but when distributing them to client, only class name remains, all properties and methods are gone, just like this
public class CameraPackages
{
private readonly List<CameraPackage> _packages;
public CameraPackages()
{
_packages = new List<CameraPackage>();
}
public void AddNewCamera(CameraPackage package)
{
_packages.Add(package);
}
public void RemoveCamera(CameraPackage package)
{
if(_packages.Contains(package))
_packages.Remove(package);
else
throw new ArgumentException();
}
}
into this: (in Reference.cs)
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class CameraPackages {
}
How can I do to allow user use my object?
View 1 Replies
Similar Messages:
Mar 29, 2011
There is an external (Java based ) web service that i am calling. I've added my service reference and verified that Reference.cs has been generated.
Then i call my service form my client website like such:
[Code]....
But my response object is mostly null after it receives the response. The properties that should have values do NOT.
When i look at Trace viewer, the SOAP request is correct and the SOAP response is correct. I get back a valid soap response with all the data i need it's just not making its way back to my response object. I've tried regenerating the proxy many different ways (svcutil) with no luck.
Example of what is in the response object (good data which is not making it's way back to my response object):
<ogc:Spatial_Capabilities><ogc:GeometryOperands><ogc:GeometryOperand>gml:Envelope</ogc:GeometryOperand><ogc:GeometryOperand>gml:Point</ogc:GeometryOperand><ogc:GeometryOperand>gml:LineString</ogc:GeometryOperand><ogc:GeometryOperand>gml:Polygon</ogc:GeometryOperand></ogc:GeometryOperands><ogc:SpatialOperators><ogc:SpatialOperator name="BBOX"></ogc:SpatialOperator><ogc:SpatialOperator name="Overlaps"></ogc:SpatialOperator></ogc:SpatialOperators></ogc:Spatial_Capabilities>
Why isn't the SOAP response making its way back to my response object?
View 4 Replies
Jun 9, 2010
I developed a C# web application that calls a web-service which returns a base64 encoded array (PDF file). I then convert that array into a UCOMIStream object (I know it is obsolete, but the DLL that I am using requires it as a parameter). I use the following code to do the conversion which works perfectly. I can pass this object to the DLL so that I can print the PDF.
This works great on the Webserver, but the requirement is to print it locally.
Byte[] bBuffer = statementOut.statementcycle.statementdata.content;
int size = bBuffer.Length;
IntPtr mem = Marshal.AllocHGlobal(size);
Marshal.Copy(bBuffer, 0, mem, size);
// Create an OLE Stream object.
System.Runtime.InteropServices.UCOMIStream str; //obsolete but the createstreamonhglobal outputs it
CreateStreamOnHGlobal(mem, true, out str);
The DLL resides on the client so I am able to use ActiveX to create the object using javascript and/or VBscript;however, I have not been able to figure out how to get the stream object to the client to pass to the DLL.
View 2 Replies
Oct 23, 2010
In MVC3 Beta version i have action result same like
public ActionResult Save(Dictionary<string, string> dicObject)
I want to pass JSON Object in POST Method from javascript and need to get as dictionary object
How can i do this? can you write example if possible?
View 5 Replies
Mar 26, 2011
I am using the webservice method of populating my radtreeview as it was described as the most efficient way to load large amounts of data. So the signature of my webservice method is:
[WebMethod]
public RadTreeNodeData[] WebServiceMethodName(RadTreeNodeData node, object context)
However, the nodes that I am populating the tree with depend on the security access of the user that is logged in to my application..Is it possible to pass additional parameters to the webservice method? Or must I use a ServerSideCallBack method to populate the tree? I am hoping that I can still use the webservices functionality... I would like to pass a signature like this to my webservice method:
[WebMethod]
public RadTreeNodeData[] WebServiceMethodName(RadTreeNodeData node, object context, object userSession)
View 1 Replies
Aug 2, 2010
I am a beginner at webservices.
I created a webservice solution using VS2010. I can browse to http://localhost:1259/ResultsWebServices/FG_Results.asmx and click on my webservice which is Get_FG_Results, enter my case num and get the XML back. Works fine as expected. FG
For trial purpose, I added another project in the same solution which is supposed to be this webservice client. I added a web refrence to Get_FG_Results. On the default page I added a GridView to display the resuls fetched by the webservice.
I have a method BindDataToGrid being called at the page load. How do I call my webservice from this method to populate the GridView?
What else do I need to do so that this webservice is available to other applications?
View 4 Replies
Jan 4, 2011
i am working in the webservice project. I have one project when i run it then shows the text box for parameters and return the result after passing the parameters.
But another webservice does not allow me to enter the paramerters when execute then list of methods displayed and then show the soap xml when click at any method.
what difference found in both webserivces are Excuting-one that have the Text boxes: Test: "To test the operation using the HTTP POST protocol, click the 'Invoke' button."
2nd One Not provide the parameter text boxes: Test: "The test form is only available for methods with primitive types as parameters"
Dont know how to fix that. Because i want to debug the webservice and as i am unable to provide the parameter then how can i fix it.
how can i pass the parameters in the 2nd webservice as it has different information mentioned above.
View 1 Replies
Nov 26, 2010
In my application I want to send an audio file (.mp3) as binary string through XML webservice, and save the binary data as audio file in server. In this case what should be the structure of XML file and how can I convert this incoming binary sting to audio file in webservice code.
Currently I tried a structure like the following
<XML>
<Files>
<File>
<FileName>audio_123.mp3</FileName>
<FileType>audio</FileType>
<FileData>![CDATA[ - binary data goes here -]]</FileData>
</File>
</Files>
</XML>
But it is not working correctly.
View 2 Replies
Jan 22, 2011
I have web service on server! This service is calling from the clients applications!
Now how i can get user name and computer name of clients that using this service, for example if application from Clint1 calling this service i want to get computer name and user name of Clint1?
View 1 Replies
Mar 3, 2010
i am trying to pass data between forms.
Public selected_Month As String
Public Property Month() As String
Get
Return selected_Month
End Get
Set(ByVal value As String)
selected_Month = value
End Set
End Property
form1: where i am assigning a value
Dim my_Class As New Class1
my_Class.Month = ddl_Month.Text.ToString()
form2: where i am geting a value
Dim my_Class2 As New Class1
MessageBox.Show(my_Class2.Month.ToString())
when i run this code, i am getting error like Object reference not set to an instance of an object.
View 6 Replies
Jan 4, 2011
I want to pass some values to price method of provided webservice, but the parameter schema is like this:
[Code]....
how I must send the price parameter value? in array or as a class?
View 1 Replies
Apr 28, 2010
I want to build a webservice that has to get some data as parameter from the client application. the data from the client side are records from there database. my websercie has to send then these data to a soap server through 'HttpWebRequest'. Can i get the data as Datatable? and then send as stream to the soap server? Or maybe there is a better easier ways?
View 2 Replies
Apr 23, 2010
I'm trying to pass a javascript object array back to a vb .asmx web service.
I can't even tell you how many different things I've tried, so i'm confused more than when I started.
Below is an example of the client side code I am using.
[Code]....
I'm adding my script reference in my vb page as follows, and can access other web methods fine.
[Code]....
how to be able to access these objects within the web service method. I need to be able to iterate though all the people from the javascripts array so that I can do some other functions, such as validation, adding them to a database, etc.
View 3 Replies
Mar 16, 2014
can datatable pass to web service as input parameter? i have a scenario to pass values as datatable to web service. eg as follows
when Invoice or Bill is entered, I want to send the entered data as datatable to web service to insert into another application.
View 1 Replies
Nov 27, 2010
Can we access a c# webservice using java client , even if there is no crossdomain.xml file present on for eg, IIS?
View 1 Replies
Jan 29, 2010
I am using DotNetOpenAuth in my ASP.Net Website. I have modified it to work with Facebook Connect as well, using the same methods and database structures. Now I have come across a problem.
I have added a Facebook Connect button to a login page. From that HTML button, I have to somehow pull information from the Facebook Connect connection and pass it into a method to authenticate the user. The way I am currently doing this is by:
Calling a Javascript Function on the onlogin function of the FBML/HTML Facebook Connect button. The javascript function calls a Web service to login, which it does correctly. The web service calls my data access layer to login. And here is the problem: FormsAuthentication.SetAuthCookie is set at the data access layer. The Cookie is beyond the scope of the user's page and therefore is not set in the browser. This means that the user is authenticated, but the user's browser is never notified. So, I need to figure out if this is a bad way of doing what I need or if there is a better way to accomplish what I need. I am just not sure and have been trying to find answers for hours.
View 1 Replies
Jan 29, 2010
i am getting the foolowing error when i am creating object od a veb serive with asp.net. using VS 2005. i am getting the below error.
System.InvalidOperationException: Method ElectronicInsuranceServiceService.addVehicleInsurance can not be reflected. ---> System.InvalidOperationException: There was an error reflecting 'string'. ---> System.InvalidOperationException:
There was an error reflecting type 'MotorIns.string'. ---> System.InvalidOperationException: Types 'MotorIns.string' and 'MotorIns.string1' both use the XML type name, 'string', from namespace '[URL]a'. Use XML attributes to specify
a unique XML name and/or namespace for the type. at System.Xml.Serialization.XmlReflectionImporter.GetTypeMapping(String typeName, String ns, TypeDesc typeDesc, NameTable typeLib, Type type) at ......
View 3 Replies
Jul 28, 2010
Some strange problem have occured while developing application. Some WCF webservice returns object with date property.On client this web service is called using Jquery.ajax.Then result is parsed using json2.For date I simply use following expressions:
var reMsAjax = /^/Date((d|-|.*))[/|\]$/;
a = reMsAjax.exec(value);
if (a)
var b = a[1].split(/[-+,.]/);
return new Date(b[0] ? +b[0] : 0 - +b[1]);
unfortunatelly if browser timezone differs simple new Date with milliseconds not works.Time will be based on timezone.
View 1 Replies
Mar 31, 2011
I have a piece of code written in 2 different ways, one a web service and another a WCF client which are trying to access an external 3rd party URL.
The same code when written as an exe works fine, i see my submissions on the 3rd party site, while the web code does not work.
I installed Fiddler to check traffic and to my surprise the web code works when Fiddler is capturing traffic, As soon as I stop Fiddler my code does not work.
For the web service code I get error: The remote name could not be resolved:
For the WCF client I get error: There was no endpoint listening at <<3rd party URL>> that could accept the message. This is often caused by an incorrect address or SOAP action.
Am quite sure now that this is because of some network and/or proxy on my corporate network, but not able to figure out what it can be.
View 1 Replies
Oct 31, 2010
How do I protect a webservice if it is called from ajax ?
Update: I realize that my question didn't reflect what I intended to ask. I don't want user to be able to do the request by pointing to it with its webbrowser but only in the context of my app.
View 2 Replies
Jan 4, 2011
I am trying to consume a third party web service. In order to access any web method I need to pass session id with soap header in each request. I am trying to modify my header but haven't been successful. I am using proxy in 2.0. I created a separate class which inherits the soap header. I have copied my code but I am not sure how to go about this. How do I attach this header to proxy.
[Code]....
View 2 Replies
Nov 24, 2010
I have an ASP.NET webservice method that returns a generics list (List'<'Construct>) serialized as JSON, using code such as this:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class TestService : System.Web.Services.WebService {
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetOccupationListJSON(int SOCLevel)
{
Construct NewConstructList = new ConstructList();
DataContractJsonSerializer serializer = new DataContractJsonSerializer(ConstructList.GetType());
MemoryStream ms = new MemoryStream();
[Code]....
I assumed (from looking elsewhere) that accessing the JSON data through the index would provide me with access to the underlying object at that index, so that I can then work with it to access its properties.
However, when i=0 and I do var Construct = data[i]; I get the character at the i position of the data array ([), and in the next iteration I get the second character ({). So clearly I am accessing the elements of a string array rather than the JSON data object.How do I make sure that the data returned by the webservice gets into proper JSON format, so that I can iterate through the object elements within it?
View 1 Replies
May 10, 2010
convert webservice xml response to object dynamically using JSON
View 1 Replies
Jan 25, 2011
I stucked at a condition , where i need to share values between the pages. I want to share value from Codebehind via little or no javascript. I already have a question here on SO , but using JS. Still did'nt got any result so another approach i am asking.
So I want to know can i pass any .net object in query string. SO that i can unbox it on other end conveniently.
Update
Or is there any JavaScript approach, by passing it to windows modal dialog. or something like that.
What I am doing
What i was doing is that on my parent page load. I am extracting the properties from my class that has values fetched from db. and put it in a Session["mySession"]. Some thing like this.
Session["mySession"] = myClass.myStatus which is List<int>;
Now on one my event that checkbox click event from client side, i am opening a popup. and on its page load, extracting the list and filling the checkbox list on the child page.
Now from here user can modify its selection and close this page. Close is done via a button called save , on which i am iterating through the checked items and again sending it in Session["mySession"].
But the problem is here , when ever i again click on radio button to view the updated values , it displays the previous one. That is , If my total count of list is 3 from the db, and after modification it is 1. After reopening it still displays 3 instead of 1.
View 5 Replies
Mar 8, 2011
I am doing a project in ASP.NET MVC in which I want to implement an IoC container. I am new to IoC containers and have been searching to find a solution to my problem, but so far to no avail.
The problem is dat data is distributed across various databases. Once a user is logged in, the database for the user is retrieved from an authorization database and then set in the user session. That user session is passed on to the services and repositories when they are constructed, so they can use it when they need it to access the database.
A typical bare stripped service (without interfaces and ioc) looks like this:
private CompetitionRepository _CompetitionRepo;
public CompetitionService(DataContext dataContext)
: this (new CompetitionRepository(dataContext))
{ }
[code]...
The "DataContext" contains a couple of properties with which the correct database is selected for the session. Because the Services and Repositories don't have access to the session itself (which is outside of their scope) they need this object.
View 1 Replies