Can a web service be created in CFScript using the New operator?
As opposed to CreateObject..
Application.UserWebService = CreateObject("webservice", "http://WebServiceURL/WebServices/UserService.asmx?WSDL");
No. The new operator only works with components, and a web service is not a component.
FWIW, you can take a look inside the {cfroot}\CustomTags\com\adobe\coldfusion directory to get an idea of which core objects are implemented as components.
Looking at the CF docs, the only one I saw was using the CreateObject..
<cfscript>
ws = CreateObject("webservice",
"http://www.xmethods.net/sd/2001/TemperatureService.wsdl");
xlatstring = ws.getTemp(zipcode = "55987");
writeoutput("The temperature at 55987 is " & xlatstring);
</cfscript>
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78b4.html
Related
I have added my web service Url to my application through the steps of "Add Web Reference" with the name of "SOAPNyd" in Xamarin Studio
Now I need to connect my web Methods, I see my web referenced methods under Web Service folder but can not connect to them and need know how to call , use my methods.
Could anyone show me one example with while loop to write down its all data to the Console please. Thank you.
here is one of my methods which returns all brands that I have at Data Base first value is empty second value is my pasword dont worry about parameters
public string getMarkalarlist(string s, string key) {
getMarkalarlistRequest1 inValue = new getMarkalarlistRequest1();
inValue.s = s;
inValue.key = key;
getMarkalarlistResponse1 retVal = ((WebDBServicesHttpGet)(this)).getMarkalarlist(inValue);
return retVal.#string;
}
a piece of my need
http://www.nullskull.com/a/10476774/consuming-web-services-using-xamarin.aspx
Problem: Want to send a custom HTTP header from Windows Phone 7.1 app to ASMX service. The ASMX service is developed by different team.
Solutions tried: There are number of questions & answers on net for this, but nothing seem to work in our case.
Refered HttpRequestMessageProperty,
and this.
Client Side Code:
HttpRequestMessageProperty httpProps = new HttpRequestMessageProperty();
httpProps.SuppressEntityBody = false;
httpProps.Headers["HeaderKey"] = "HeaderValue";
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpProps;
Service Side Code:
public string GetHeaderValue()
{
var properties = OperationContext.Current.IncomingMessageProperties;
var property = properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
string headerValue = property.Headers["HeaderKey"];
return headerValue;
}
The "HeaderKey" value is not available on service side. Can any one point us in right direction ? Any help will be appreciated.
Thank you.
Ok, So after some hits and misses, the below code worked:
HttpContext.Current.Request.Headers.GetValues("HeaderKey")[0];
The issue with using OperationContext was for ASMX the OperationContext.Current was null. In WCF service, the OperationContext.Current is available.
Thanks #user623396 for your time and efforts. Hope this helps someone out.
I have created a sample application to get full idea of Spring MVC with REST Webservice. I have created an application which host webservice and a client which calls to this webservice and fetch the relevant data. I am able to pass the arguments from client side like String, and able to receive the data as List or single object, and till here it goes smooth..
Now I want to pass the List as an argument from client side, and also want to implement on webservice side to get the List which is passed from client application. Can anyone helpout with this scenario?
Please find code snippet of my working version.
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("appContext.xml", Client.class);
RestTemplate restTemplate = applicationContext.getBean("restTemplate", RestTemplate.class);
String url;
// retrieve a list of customers
url = "http://localhost:8080/restful-ws/app/testlist.xml";
List<CustomerBean> custList = (List) restTemplate.getForObject(url, List.class);
for (CustomerBean cust : custList) {
System.out.println(">> cust :"+ cust.toString());}
Web Service side implementation.
#RequestMapping(method=RequestMethod.GET, value="/testlist")
public ModelAndView showCustomers() {
ModelAndView mv = new ModelAndView("customerListKey");
List<Customer> custs = new ArrayList<Customer>();
for (Customer customer:customers.values()) {
custs.add(customer);
}
mv.addObject("allCustomers", custs);
return mv;
}
also i have related files, but if will put all code snippets, it will become too much. Mainly my query is how can I pass List from client side and how can i get it from receiver/server side?, in both side i am using spring only
Thanks in advance for your time and help.
-Ronak.
Use an array of CustomerBean
CustomerBean[] custList = restTemplate.getForObject(url, CustomerBean[].class);
The conversion from array to list is left as an exercise for the interested reader...
Goal:
Retrieve data from Dynamics CRM 2011 to my database from SQL server R2 by using webservice through integration services (SSIS). Webservice needed to be located inside of SSIS. Gonna use the data for data warehouse.
Problem:
How do I do it?
We only write to Dynamics so I can't address the specific method name but the general idea below should get you started.
Assumptions
Two variables have been defined in your package and they are passed to the script component as ReadOnlyVariables: CrmOrganizationName, CrmWebServiceUrl.
A script component has been added to the dataflow as a Source component. On the Inputs and Outputs tab, an appropriate number of columns have been added to Output 0 (or whatever you define your output collection as) with appropriate data types.
Inside the script, add a web reference to your CRM instance. This code assumes it's called CrmSdk.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
// web reference
using CrmSdk;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
public override void CreateNewOutputRows()
{
// Get a reference to the CRM SDK
CrmSdk.CrmService CrmService = new CrmSdk.CrmService();
// An Authentication Token is required because CRM requires an OrganizationName
// to identify the Organization to be used
CrmSdk.CrmAuthenticationToken token = new CrmSdk.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = this.Variables.CrmOrganizationName;
CrmService.CrmAuthenticationTokenValue = token;
// Use default credentials
CrmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Get the web service url from the config file
CrmService.Url = this.Variables.CrmWebServiceUrl;
//////////////////////////////////////////////////
// This code is approximate
// Use the appropriate service call to get retrieve
// data and then enumerate through it. For each
// row encountered, call the AddRow() method for
// your buffer and then populate fields. Be wary
// of NULLs
//////////////////////////////////////////////////
foreach (CrmSdk.entity person in CrmService.Get())
{
Output0Buffer.AddRow();
Output0Buffer.FirstName = person.FirstName;
Output0Buffer.LastName = person.LastName;
}
}
}
Caveats
There is no error handling, checks for nulls or anything elegant. The service should probably have been defined with the using statement, etc, etc, etc. It should provide an appropriate starting point for understanding how to consume a web service and load data into the pipeline.
The easiest solution for your requirement is to use a third-party library for SSIS. The commercial COZYROC SSIS+ library includes Dynamics CRM adapters, which support all deployment models: Premise, Live, Hosted, Federation, Office 365.
i've got a webservice that is running on my local iis. Now i am trying to consume this webservice from a windows application.
I've added loggin in the web service that i am sure it is actually returning the data and it is.
But when i try and retreive it from my application it returns an empty datatable.
Any suggestions It actually breaks at where you get the datarow sins there are no data in the dattaable.?
PayM8Service payM8Service = new PayM8Service();
localhost.PayM8DataSet.PayM8DetailsGetDataTable payM8DetailsGetDataTable = payM8Service.GetPayM8Details(999999999, "631023012");
localhost.PayM8DataSet.PayM8DetailsGetRow row = (localhost.PayM8DataSet.PayM8DetailsGetRow)payM8DetailsGetDataTable.Rows[0];
decimal asd = row.Arrears;
decimal asda = row.Balance;
The DataTable, DataRow, DataView, and DataViewManager objects cannot be serialized and cannot be returned from an XML Web service. To return less than a complete DataSet, you must copy the data that you want to return to a new DataSet.
http://support.microsoft.com/kb/306134