Passing Values from XML to Web Service Using SSIS - c#

I've been having trouble accomplishing the following task and was looking for input from the community on how I might go about solving it; if this is the wrong place to post this, please let me know and I will move it.
Using a SSIS package I am trying to:
Read values from an XML document.
Pass those values to a web service.
Record the return value in a new XML document (or a flat-file for simplicity sake).
For reference, let's take a simple example. I want to pass a series of currency types to this web service:
http://www.webservicex.net/ConvertTemperature.asmx
So far I have:
Added HTTP Connection Manager - Configured to access the WSDL file at http://www.webservicex.net/CurrencyConvertor.asmx?wsdl
Created a Web Service Task using the HTTP Connection, made and referenced the WSDL file.
The input fields can be selected manually, for example, CAD to USD.
The output can be easily saved to a specified output.
I have two main problems; the first would be passing the columns from the XML source to the web service and the second is I'm not sure how to handle the datatypes of the web service. In the example web service, the datatype for the currency is "Currency" but that is not a defined datatype within BIDS.
Any advice on this matter would be greatly appreciated.

emphasized textcheck out this link which passes data from a flat file source to a web service.
http://www.vsteamsystemcentral.com/cs/blogs/applied_team_system/archive/2007/01/10/247.aspx

Related

Handling Authentication for a File Display using a Web Service

This is my first time developing this kind of system, so many of these concepts are very new to me. Any and all help would be appreciated. I'll try to sum up what I'm doing as efficiently as possible.
Background: I have a web application running AngularJS with Bootstrap. The app communicates with the server and DB through a web service programmed using C#. On the site, users can upload files and reference them later using direct links. There's no restriction to file type (yet), so just about anything is allowed.
My Goal: Having direct links creates a big security problem for me, since the documents/images are supposed to be private data. What I would prefer to do is validate a user's credentials when the link is clicked, then load the file in the browser using a more generic url path.
--Example--
"mysite.com/attachments/1" ---> (Image)
--instead of--
"mysite.com/data/files/importantImg.jpg"
Where I'm At: Not very far. My first thought was to add a page that sends the server request and receives a file byte stream along with mime type that I can reassemble and present to the user. However, I have no idea if this is possible using a web service that sends JSON requests, nor do I have a clue about how the reassembling process would work client-side.
Like I said, I'll take any and all advice. I'd love to learn more about this subject for future projects as well, but for now I just need to be pointed in the right direction.
Your first thought is correct, for it, you need to use the Response object, and more specifically the AddHeader and Write functions. Of course this will be a different page that will only handle file downloads, so it will be perfectly fine in your JSON web service.
I don't think you want to do this with a web service. Just use a regular IHttpHandler to perform the validation and return the data. So you would have the URL "attachments/1" get rewritten to "attachments/download.ashx?id=1". When you've verified access, write the data to the response stream. You can use the Content Disposition header to set the file name.

Modifying SharePoint List Using ASMX WebServices

I am writing a custom piece of code that dynamically creates modified document libraries. I've attempted to create a document library template, which succeeds in the UI but cannot be found via-webservices.
So to get to the point - I am attempting to:
1. Set "Allow Management Of Content Types" on the list.
2. Add a new Content Type (Already Created) to the list.
3. Set the new content type as the default content type.
4. Remove the "Document" content type from the list.
So far I have succeeded in being able to "Apply" the custom content type but the others are evading my grasp. The methods I have attempted are through the Lists.asmx service and the method described here: http://msdn.microsoft.com/en-us/library/websvclists.lists.updatelist.aspx
I tried setting the Flags property and a few other potential candidates with no success and no error messages complaining about what I was trying to attempt.
One limitation is that I do NOT have access to the sharepoint dll where this is living.
Once completed - this would be a plugin living in another non-sharepoint system. The only option to include the SharePoint client dll's would be to perform an ILMerge.
EDIT:
http://msdn.microsoft.com/en-us/library/sharepoint/jj193051.aspx (SharePoint 2013 Web Services)
http://msdn.microsoft.com/en-us/library/ee705814(v=office.16).aspx (SharePoint 2010 Web Services)
and yes - technically the ASMX services sound like they're on their way out: http://msdn.microsoft.com/en-us/library/sharepoint/jj164060.aspx
Edit: Tags are relevant to the question.
use SharePoint Client Object Model. This is a library that wraps calls to webservices that allows among other things to batch commands.
The operations you mention are all available.
here is a link to an article that explains Client Object Model:
http://www.codeproject.com/Articles/399156/SharePoint-2010-Client-Object-Model-Introduction
The article focus on ListItems but you can also interact with list properties, even web properties if you want.
Please note that you don't need to run Client Object Model from your sharepoint server. Note the "Client" part in the name.

reporting services and custom datasource

I'm new to reporting services and ask for the possibily of using custom object as datasource? i'm using asp.net, visual web developer 2008 express edition and c#, if yes can you give an example. thanks for help
You can't use POCO as a data source directly in reporting services. There are a few ways to do this.
The simplest it to save your data to a database and query the database.
You could serialize the object to XML and query that by either including the XML directly into your query in an <XmlData> element, or calling a web service to retrieve the XML.
Create an XML Data Source for a Web Service
In your report project, right click on the Shared Data Sources folder.
Select Add New Data Source.
Set the Name to use.
Set the Type to XML.
Set the connection string to http://MyWebServer/MyWebServiceEndpoint.asmx.
Go to the Credentials page.
Configure the authentication.
Click OK.
You'll need to examine the WSDL for the web service and see the following references to help you build the query:
Reporting Services: Using XML and Web Service Data Sources
XML Query Syntax for XML Report Data (SSRS)
Element Path Syntax for XML Report Data (SSRS)
Here's a list of supported data sources from msdn: Data Sources
You would simply add a shared data source to your project (example: MyDataSource.rds) and choose from the available types. There, you would simply supply the appropriate credentials. Each of your reports would use the data source.
EDIT
Here's a simple tutorial on adding a data source: Creating a Shared Data Source in Reporting Services

Server side PHP sql queries to C# app

I'm retrieving some userdata from a phpbb3 forum through scripts on the server.
My database does not allow for external login, so I have to go through some kind of script.
But, I'd like to know if there is a safe enough way to retrieve this data?
I know how to output some XML with echo statements, but I'm not sure if this is as secure as it should be?
Optimal method would be (psuedo code)
$array['user_id'] = $id;
$array['otherinfo'] = $var
return $array;
if I could somehow read this array with C#, it would be much easier, but I'm not sure how this would work with WebResonses or whatnot.
Any ideas?
You need a web service, that will output your responses in some format that you can parse with C#.
Php and C# are not interoperable, that s why you will need to create a service that you can consume these messages.
First option as I said is to create a web service, that C# code can consume. In this case, your C# code should know what to ask from your php web service, and you will respond to the request, in XML, or JSON or whatever format you want to use within your C# code to parse it.
Another option is to push the data to a web service that uses C#. You need to write a WCF/ Web service, and you can push the data to this service.
I suggest you to give your array output as xml or json. If we take xml as consideration, you can call the php file which gives xml output like this:
XDocument.Load("http://whatever.com/whatever.php");
And ofc you need to add the System.Xml.Linq header to use XDocument class. And also you can pass a hashed key, etc. from query string to validate the requested is coming from your app.

Describing ASMX web service WebMethod parameters

This seems like a simple question, but I haven't been able to find the answer online via many Google searches. I have a C# web service and, when I visit its ASMX page in the browser, for a particular method it always has the following:
"The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values."
Likewise for SOAP 1.2 and HTTP POST. What I want to know is how I replace the placeholders shown, which are things like:
<myParameter>string</myParameter>
Where 'string' is the placeholder. And in the response:
<xsd:schema>schema</xsd:schema>xml
Where 'schema' and 'xml' are the placeholders. I've been using another web service that has these placeholders filled out with example values for the parameters and responses, and I would like to define such examples for my own web methods, too. I was able to describe the entire method with the following:
[WebMethod(Description="Does awesome things.")]
But I have not found such a thing for the individual parameters of a web method.
By default DefaultWsdlHelpGenerator.aspx is called to generate the "help" page.
You can set another (or modified) template with the wsdlHelpGenerator Element in your web.config file.
Why would you want to do that? That page you see in the browser when hitting your asmx is just giving sample requests and reponses. If you want to get data using those examples, replace the placholder values in the request with what you are querying from the service, and POST to it...
Edit: I mean, if you really need to replace those placholder values, write code in your service to determine when someone does a GET (implying viewing from a browser), and play with the response, changing the placeholder values to whatever you require.
You can't do it. If the help page (which is what you're describing) does not have an input box for a particular parameter, then it means it doesn't know how to do that.
You should not pay too much attention to those pages in any case. They go away with WCF.
They were never of very much use anyway, except for the simplest web services. They were a way to get people into the web service game way back in the beginning when there were no tools to help you test a web service. Use soapUI instead.
BTW, also see Microsoft: ASMX Web Services are a “Legacy Technology” for why it makes good sense to ignore ASMX-only pages.

Categories

Resources