Well that's a mouthful for a title. Let me start out by saying that I am not a programming per se but a DBA. I can write some MSSQL query with the best of them but my knowledge of C# is pretty limited. I have a piece of software that I need to communicate with via web services to push some data to all within the constraints of SQL Server Integration Services. I can read from the DB directly but I can not write to it. I'm querying some data, emailing that data, and I need to write back to the software for reach record we emailed through web services. The WSDL is available but like I said, zero knowledge of C#. I was able to build a SOAP envelope through SOAPUI that works perfectly and I would like to figure out a way call SOAP using a C# script in my SSIS package.
I have also tried to run this in the Web Service Task in SSIS and my WSDL file only gives me 4 methods when I should have close to a hundred. It would be easier there to sort out but I understand there are some limitations with the SSIS Web Service Task.
I have seen this thread: Client to send SOAP request and received response
Which unfortunately does not work for me when I copy and paste my SOAP and header into the code. To throw another wrench this thing, this is a protected web services which requires 3 credentials to have a token issued for passing data back and forth. A side question is can I run multiple SOAP calls (first to authenticate, then to push my data into the web service) through a C# script?
Here was my second soap call after getting the token that I was able to run:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:v2="http://www.WSAPI.AMS360.com/v2.0">
<soapenv:Header>
<v2:WSAPIAuthToken>
<v2:Token>tokenremoved</v2:Token>
</v2:WSAPIAuthToken>
</soapenv:Header>
<soapenv:Body>
<v2:InsertActivity_Request>
<!--Optional:-->
<v2:Activity>
<v2:AssignedTo>93725c05-f77b-49a1-9edd-6ce9fd5505c1</v2:AssignedTo>
<!--Optional:-->
<v2:ActivityType>customer</v2:ActivityType>
<v2:ActivityAction>% of ownership</v2:ActivityAction>
<!--Optional:-->
<v2:ActivityDate>11/04/2014</v2:ActivityDate>
<!--Optional:-->
<v2:ActivityTime>11:54</v2:ActivityTime>
<!--Optional:-->
<v2:EmployeeCode>!$5</v2:EmployeeCode>
<v2:Description>web services test code successfully inserted</v2:Description>
</v2:Activity>
</v2:InsertActivity_Request>
</soapenv:Body>
</soapenv:Envelope>
Related
i am currently building a Client to communicate with a Gateway of a Charge Point.
The communication is build with OcppV1.5 over Soap & Http.
The Server doesn't accept my request. I get a Http Response 500 with the Error Reason:
"XML Request is not well formed, Action does not exist."
I looked into the wsdl files but I just don't understand why it doesn't accept my action.
My Request looks something like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="https://www.w3.org/2005/08/addressing" xmlns:cs="urn://Ocpp/Cp/2012/06/">
<SOAP-ENV:Header>
<cs:chargeBoxIdentity>0000.0000</cs:chargeBoxIdentity>
<wsa:From>
<wsa:Address>http://000.000.000.000:0000</wsa:Address>
</wsa:From>
<wsa:To>http://000.000.000.001:0001</wsa:To>
<wsa:Action>/ChangeConfiguration</wsa:Action>
<wsa:MessageID>00000.000000000000</wsa:MessageID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<cs:changeConfigurationRequest>
<cs:key>MeterValueSampleInterval</cs:key>
<cs:value>60</cs:value>
</cs:changeConfigurationRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Update:
As Bogdan suggested I tried to send the same message using SoapUi and it worked. The generated Request from SoapUi looks like this:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="urn://Ocpp/Cp/2012/06/">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<ns:chargeBoxIdentity>000000.00000</ns:chargeBoxIdentity>
<wsa:Action>/ChangeConfiguration</wsa:Action>
<wsa:ReplyTo>
<wsa:Address>http://000.000.000.000:0000</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>uuid:00000000-0000-0000-0000-000000000000</wsa:MessageID>
<wsa:To>http://000.000.000.000:00000/</wsa:To>
</soap:Header>
<soap:Body>
<ns:changeConfigurationRequest>
<ns:key>MeterValueSampleInterval</ns:key>
<ns:value>300</ns:value>
</ns:changeConfigurationRequest>
</soap:Body>
</soap:Envelope>
It's hard to tell from what you posted why you are getting an error, so I can only add some information that can hopefully allow you to troubleshoot the issue.
Your message has WS-Addressing headers, <wsa:Action> being one of them. The value of this field should be specified in the WSDL if your WSDL also includes WS-Addressing Metadata information, or should be specified in the documentation of the web service you are invoking. Your error message "XML Request is not well formed, Action does not exist" seems to indicate that there might be an issue with this field, but there is another action that SOAP services have which is a SOAP action. I asked about it in the comment above to make sure it's eliminated as a source of problems. In SOAP 1.1 it's called SOAPAction and is a separate HTTP header, while in SOAP 1.2 it's an action parameter on the HTTP Content-Type header. Based on the http://www.w3.org/2003/05/soap-envelope namespace, you have a SOAP 1.2 message.
With these explanations layed out, I suggest you take the WSDL and feed it to SoapUI who can generate sample requests that you can use to invoke the web service. If the WSDL also contains WS-Addressing Metadata, SoapUI should be able to pick it up and help you fill in the values you need. If not, look again through the WSDL for Action elements (make sure you differentiate between the SOAP Action and the WS-Addressing Action using their XML namespaces) or through the service documentation.
Once you get a succesfull call using SoapUI, then try to duplicate it with your code. At that point you can again use SoapUI to troubleshoot things and inspect your code built message to see it resembles the one you can successfully send with SoapUI.
Hope this helps get you closer to a resolution.
Good day.
i am hoping that someone could assist me. I am creating a web service (this is the first time i have ever created a web service). i have worked with web services/API in the past from a client side by creating soap xml messages and sent and received messages back and forth. Now i need to create my own web Service and am needing a little assistance with creating it correctly.
i initially created a simple web method as follows.
[WebMethod(Description = "Soap Request")]
public string Request(string xmlDocument)
{
//do work
}
but when i tried consuming this method i received the following error:
System.Web.HttpRequestValidationException: A potentially dangerous
Request.Form value was detected from the client
i then tried (after googling) to change the method as follows:
[WebMethod(Description = "Soap Request")]
public string Request(XmlDocument xmlDocument)
{
//do work
}
but that didnt seem to work either, when i tried to send an xml soap message to this method it came through empty. What i then did was to create the method with parameters matching the elements in my xml Soap message. the method then picked up each element and populated the parameters correctly as follows.
public void Request(string parm1, string parm2)
{
//do work
}
with the following xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Request>
<tem:Parm1>111</tem:Parm1>
<tem:Parm2>222</tem:Parm2>
</tem:Request>
</soapenv:Body>
</soapenv:Envelope>
i would like to find out, is this the correct way to handle the incoming message or is there something else i should be doing to accept the incoming xml message? i thought that i could create the method as i had initially done that it would accept the xml string passed to it and i could work with the message as i did when receiving xml message back from web services i used in the past.
please forgive me if i have duplicated a question, i could not find anything that would give me a definite answer.
i have started creating the web service in Visual Studio 2019.
any assistance or advise would be greatly appreciated.
I was having the exact same issue. So in my project I just added this to my web.config/system.web/httpRuntime:
requestValidationMode="2.0"
And It just worked!
Hi I am developing web application which contains Siebel web service integration. All request/response cycle will take place through XML. It is basically SOAP service. I do not have idea on siebel and soap xml. I am trying to integrate siebel service in WebAPi2. Client have provided me request and response and created sample service to test. I am able to invoke siebel service in fidler. In my webapi2 i want to integrate service.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rol="Some Url">
<soapenv:Header/>
<soapenv:Body>
<rol:process>
<rol:IDType>National Id</rol:IDType>
<rol:Type>Customer</rol:Type>
// other parametrs
</rol:process>
</soapenv:Body>
</soapenv:Envelope>
Below is the response
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:MessageID>urn:some id</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:FaultTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:FaultTo>
</env:Header>
<env:Body>
<processResponse xmlns="some url">
<result>1-198A3H</result>
<Contact_Integration_Id>1-198A3H</Contact_Integration_Id>
<SIEBEL_ERROR_CODE/>
<SIEBEL_ERRROR_MESSAGE/>
</processResponse>
</env:Body>
</env:Envelope>)
Also they have provided Public url to hit the API.
As i do not know Siebel integration in .Net and i did not find any suitable tutorial I am expecting some help from here. Any help/suggestion i get here highly appreciated. Thank you.
Although #AJPerez is correct that this is not really a Siebel issue, I would like to recommend you request for the WSDL (Web Service Definition file) from which your example message is generated. Without it you'll find it hard to use the generic .NET tutorials regarding web services.
.NET has no doubt a generator that takes a WSDL as input and generates a set of classes and functions for you to use.
I've scoured the internet for the past two weeks and tried so many different ways that I'm beginning to think this might not be possible via a web service task in SSIS. I've created a web service task in SSIS by using a provided WSDL - see screenshot below.
As you can see the requirement for this web service method is to pass in an XML node which contains filter items like so:
<FilterItems><FilterItem FilterItemId="12345">4/20/2015 12:00:00 AM</FilterItem></FilterItems>
This "FilterItems" node is to be nested in between another XML element named "TemplateValues" - see soap body:
<soap:Body>
<GetReportResults xmlns="https://service.service.com">
<username>string</username>
<password>string</password>
<reportId>int</reportId>
<templateValues>xml</templateValues>
</GetReportResults>
The problem I'm facing is that when I go to chose a data type in the variable list in SSIS, there is no XML data type so I have to use a string. The funny part is that I can use SOAPUI and call the same method with no issues just by passing in:
<FilterItems><FilterItem FilterItemId="12345">4/20/2015 12:00:00 AM</FilterItem></FilterItems>
Here is the SOAPUI call that I am able to use:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="https://service.servicename.com">
<soapenv:Header/>
<soapenv:Body>
<ser:GetReportResults>
<!--Optional:-->
<ser:username>username</ser:username>
<!--Optional:-->
<ser:password>12343</ser:password>
<ser:reportId>000</ser:reportId>
<!--Optional:-->
<ser:templateValues>
<FilterItems><FilterItem FilterItemId="12345">4/20/2015 12:00:00 AM</FilterItem></FilterItems>
</ser:templateValues>
</ser:GetReportResults>
</soapenv:Body>
</soapenv:Envelope>
As you can see, I've just pasted the xml in between the element and SOAPUI processes the request with no problem - so why can't SSIS web service task process this same request?
My thoughts are that since SSIS is forcing me to use a string variable to store the xnlNode that certain characters are being parsed. Here are the results of the variable when I debug and run the web service task:
Value <FilterItems><FilterItem FilterItemId=\"12345\">4/20/2015 12:00:00 AM</FilterItem></FilterItems>
The debugging results show that the quotes have been escaped and I believe this is part of the problem. Here are some other things I've tried:
Passing in entirely encoded XML(also tried using CDATA):
<FilterItems><FilterItem FilterItemId="12345">4/20/2015 12:00:00 AM</FilterItem></FilterItems>
I also tried creating a SQL task and when executed would grab the xml and add it to a variable. Once again at runtime, escape characters were added in for the quotes causing the method not to execute. I'm finding it hard to believe that this is not a common issue and there isn't an easy workaround to passing in XML into a web service task. Is this a fault in SSIS or just something that hasn't been implemented? Help would be much appreciated!
It looks like the only answer is to change the web service to accept only simple types as parameters. I have scoured the web and there seems to be no way to dynamically create complex types for consumption by the input values in the web service task.
See also: Create complex-type variables for a Web Service Task
We have an old bit of code, ASMX WebService, that we have lost the source to. I am trying to replicate the behavior of this so we can take control of it once again without affecting any of the clients.
I have created a class that mimics the behavior and properties of the response, and a soap request returns as follows
<soap:Body>
<LoginResponse>
<LoginResult>
<UserId>string</UserId>
<Password>string</Password>
</LoginResult>
</LoginResponse>
Now the service I am trying to replicate returns
<soap:Body>
<LoginRS xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserId>string</UserId>
<Password>Password</Password>
</LoginRS>
</soap:Body>
Now LoginRS is the name of the class I have made. My question is how do I make my response look like the second response.
I am replicating this in c# ASMX and am using the following
[WebMethod(MessageName="Login")]
public LoginRS Login(string password, string userId)
Thanks for you time.
If your objective is to reverse engineer the service, and if the service dll is with you, you can use .NET Reflector (google it) to read the dll and provide you the exact source code.