I created a couple of WCF services. One very robust one that can accept both SOAP and RESTful requests, and provide XML and JSON responses.
--EDIT: FYI: Enabling an SOAP endpoint to accept a RESTful request requires the use of [WebGet..., and as such, all input parameters must be of type string.
The other, a simple RESTful connector. The WSDL for the first service validates, however for the second, very simple RESTful connector - invalid.
I was using WSDL2Java to to complete the connection process, but fails, due to an invalid WSDL.
Am I mistaken in thinking that WSDL v2.0 is being generated?
Here is the WSDL from the service:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="RESTService" targetNamespace="http://antennasoftware.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://antennasoftware.com" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsdl:types>
<xsd:schema targetNamespace="http://antennasoftware.com/Imports">
<xsd:import schemaLocation="http://localhost/VRPCWebServices/RestService.svcxsd=xsd0" namespace="http://antennasoftware.com"/>
<xsd:import schemaLocation="http://localhost/VRPCWebServices/RestService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IRESTService_GetXMLData_InputMessage">
<wsdl:part name="parameters" element="tns:GetXMLData"/>
</wsdl:message>
<wsdl:message name="IRESTService_GetXMLData_OutputMessage">
<wsdl:part name="parameters" element="tns:GetXMLDataResponse"/>
</wsdl:message>
<wsdl:message name="IRESTService_GetJSONData_InputMessage">
<wsdl:part name="parameters" element="tns:GetJSONData"/>
</wsdl:message>
<wsdl:message name="IRESTService_GetJSONData_OutputMessage">
<wsdl:part name="parameters" element="tns:GetJSONDataResponse"/>
</wsdl:message>
<wsdl:portType name="IRESTService">
<wsdl:operation name="GetXMLData">
<wsdl:input wsaw:Action="http://antennasoftware.com/IRESTService/GetXMLData" message="tns:IRESTService_GetXMLData_InputMessage"/>
<wsdl:output wsaw:Action="http://antennasoftware.com/IRESTService/GetXMLDataResponse" message="tns:IRESTService_GetXMLData_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="GetJSONData">
<wsdl:input wsaw:Action="http://antennasoftware.com/IRESTService/GetJSONData" message="tns:IRESTService_GetJSONData_InputMessage"/>
<wsdl:output wsaw:Action="http://antennasoftware.com/IRESTService/GetJSONDataResponse" message="tns:IRESTService_GetJSONData_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="RESTService"/>
</wsdl:definitions>
.NET does not support WSDL v2. This is WSDL 1.0.
According to XMLSpy:
attribute 'element' in message part 'parameters' (message
'IRESTService_GetXMLData_InputMessage') refers to element
'tns:GetXMLData' which is not defined within the WSDL file!
Related
Not sure if it is a right place, but will try here.
I have a Spring MVC app deployed on Amazon Elastic Beantalk, using log4j2.
Locally, the logs work well.
this is the config:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
<RollingFile
name="MyFile"
fileName="${sys:catalina.home}/logs/log4j2.log"
filePattern="${sys:catalina.home}/logs/log4j2-%d{MM-dd-yyyy}-%i.log"
immediateFlush="true">
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="5 MB"/>
</Policies>
<DefaultRolloverStrategy max="2000"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.apache.log4j.xml" level="debug"/>
<Root level="info">
<AppenderRef ref="STDOUT"/>
<AppenderRef ref="MyFile"/>
</Root>
</Loggers>
</Configuration>
But on EC2 amazon instance, where the ElasticBeanstalk app is running, no appenders working. even SYSTEM_OUT doesn't logged into catalina.out. Absolutely no clue why can that happens :(
Btw before i have experience using ElasticBeanstalk, and usually hadprobs with File appender, but at least log is appended to catalina.out .
Any idea what should i check?
I am writing an app in VS2013 (VB) to replace our site's text editor, TXTextControl from v16 to their new HTML5 editor v22. I did not write the original code, but I have a tight release deadline so I'm trying to duplicate the original project as closely as possible, from the original code. We already have a web service written in VS2010 (VB) to fill merge codes with data from our database. I have deleted and re-added the web service multiple times, tried both a Service Reference and a Web Reference, deleted the reference and cleaned the project, etc. I still am getting a "Type Expected" area when I try to dimension an object of the web service class. Here is that code (subbing 'asdf' for my actual domain):
Dim document As com.asdf.cms.service.FileManager.FileManager = New com.asdf.cms.service.FileManager.FileManager()
I have a project setting, web service type, application scope, named BrowserControlApp_com_asdf_cms_service_FileManager_FileManager, which has a value of http://ws.staging.asdf.com/Services/FileManager/.
The following is in my web.config file:
<applicationSettings>
<BrowserControlApp.My.MySettings>
<setting name="BrowserControlApp_com_asdf_cms_service_FileManager_FileManager"
serializeAs="String">
<value>http://ws.staging.asdf.com/Services/FileManager/</value>
</setting>
</BrowserControlApp.My.MySettings>
</applicationSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FileManagerSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://ws.staging.asdf.com/Services/FileManager/FileManager.asmx"
binding="basicHttpBinding" bindingConfiguration="FileManagerSoap"
contract="com.asdf.cms.service.FileManager.FileManager.FileManagerSoap"
name="FileManagerSoap" />
</client>
</system.serviceModel>
One strange thing I noticed is that the wsdl file contains two completely different locations for the service - one of which, while visually similar to the actual service URL is not even a valid URL for
the service as seen in the following snippet:
<wsdl:operation name="LoadEnvelope">
<soap12:operation soapAction="http://asdf.com/cms/services/filemanager/LoadEnvelope" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="FileManager">
<wsdl:port name="FileManagerSoap" binding="tns:FileManagerSoap">
<soap:address location="http://ws.staging.asdf.com/Services/FileManager/FileManager.asmx" />
</wsdl:port>
<wsdl:port name="FileManagerSoap12" binding="tns:FileManagerSoap12">
<soap12:address location="http://ws.staging.asdf.com/Services/FileManager/FileManager.asmx" />
</wsdl:port>
I believe I've provided all the pertinent information. Can anyone see why my service type is not resolving? Thanks in advance, and any help is appreciated!
Thanks,
Mike
Wonder if you guys can help. I have used the BizTalk WCF Service Publishing wizard to expose an Orchestration via WCF-WebHttp, and I can see the service and I am able to send requests to it via SOAPUi etc, however, I cannot see any of the schemas when I try and add the service reference to a .NET application. I've ensured that the schemas are in the same project, and that the actual DLL is GAC'd before deploying the service.
I've looked at the wsdl but I cannot see anything related to the schemas.
<wsdl:types>
<xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Message" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/Message">
<xs:complexType name="MessageBody">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="ITwoWayAsync_BizTalkSubmit_InputMessage">
<wsdl:part name="message" type="q1:MessageBody" xmlns:q1="http://schemas.microsoft.com/Message" />
</wsdl:message>
<wsdl:message name="ITwoWayAsync_BizTalkSubmit_OutputMessage">
<wsdl:part name="BizTalkSubmitResult" type="q2:MessageBody" xmlns:q2="http://schemas.microsoft.com/Message" />
</wsdl:message>
<wsdl:portType name="ITwoWayAsync">
<wsdl:operation name="BizTalkSubmit">
<wsdl:input wsaw:Action="BizTalkSubmit" message="tns:ITwoWayAsync_BizTalkSubmit_InputMessage" />
<wsdl:output wsaw:Action="http://www.microsoft.com/biztalk/2006/r2/wcf-adapter/ITwoWayAsync/BizTalkSubmitResponse" message="tns:ITwoWayAsync_BizTalkSubmit_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="BizTalkServiceInstance" />
</wsdl:definitions>
When I try and add a service reference to the service, it successfully adds the reference, but for the method called BizTalkSubmit, it only takes a parameter of System.ServiceModel.Channels.Message.
Any ideas greatly appreciated.
Regards
Jazzyuk
I would recommend that you publish using WCF-WSHttp first, then changing to WCF-WebHttp afterwards. This will enable you to choose a schema to publish:
First of all, here is my setup:
.Net 4.0 ASP.Net application
WCF service, with basicHttpBinding (soap 1.1)
The reference class was generated using svcutil, with the options /useSerializerForFaults; the WSDL defines all operations, and provides links to the types.xsd and the types_fault.xsd files. FYI, the WSD and XSD files are common for many applications so I cannot modify them (unless of course there some major validation errors)
My issue stands when I send a SOAP Fault to the client : I am unable to access the correct type in the code, for the fault detail, so the client is not able to process this fault.
Here is an extract of the WSDL for your understanding:
<wsdl:message name="CreateScheduledWorkRequest">
<wsdl:part name="parameters" element="root:CreateScheduledWork"/>
</wsdl:message>
<wsdl:message name="CreateScheduledWorkResponse">
<wsdl:part name="parameters" element="root:CreateScheduledWorkResponse"/>
</wsdl:message>
<wsdl:message name="CreateScheduledWorkFault">
<wsdl:part name="parameters" element="root:CreateScheduledWorkFault"/>
</wsdl:message>
<wsdl:portType name="ManageScheduledWorkScheduledWorkManagement">
<wsdl:operation name="CreateScheduledWork">
<wsdl:input name="CreateScheduledWorkRequest" message="intf:CreateScheduledWorkRequest"/>
<wsdl:output name="CreateScheduledWorkResponse" message="intf:CreateScheduledWorkResponse"/>
<wsdl:fault name="CreateScheduledWorkFault" message="intf:CreateScheduledWorkFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ManageScheduledWorkScheduledWorkManagementBinding" type="intf:ManageScheduledWorkScheduledWorkManagement">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="CreateScheduledWork">
<wsdlsoap:operation soapAction="http://www.orange.com/MACHX/Interfaces/ManageScheduledWork/ScheduledWorkManagement/v1/CreateScheduledWork"/>
<wsdl:input name="CreateScheduledWorkRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="CreateScheduledWorkResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="CreateScheduledWorkFault">
<wsdlsoap:fault name="CreateScheduledWorkFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
So for example, when I send a Response back (no errors occurred), I can use the CreateScheduledWorkResponse element, and fill it correctly; but when a FaultException occurs, I'm only able to send back a CreateScheduledWorkFaultMessage (and not a CreateScheduledWorkFault). And the client cannot handle this tag...
In other words, the CreateScheduledWorkFault type is not available in the code.
--> I suspect that there is something wrong when generating the code from the WSDL and XSD using svcutil, as I am not able to access the desired type in the code.
I use svcutil this way:
svcutil /useSerializerForFaults CSW.wsdl CSW.xsd CSW_Fault.xsd
Thanks for your help, and don't hesitate if you need more details.
Boris
My solution was to modify directly the type in the generated class... it's bad, but in my situation it was the only choice I had (normally I should never regenerate it as the WSDL will never change).
Now I have another issue, but it's more namespace related, so I will open a new question for that.
i am using flex to finish a browser client which needs to get the web service,
<s:WebService id="wsTest" wsdl="blablabla">
<s:operation name="?" result="doResault(event)">
<s:request>
</s:request>
</s:operation>
</s:WebService>
but problem comes,because this wsdl is generated by BEPL and i can't see a operation name there,so what should i do?
the wsdl generated by BEPL is listed below,i have deleted many things :
BEPL supposed to be something like a big function,just don't know where is the entrance of bepl and which method i should use
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions>
<wsdl:types>
...
</wsdl:types>
<wsdl:message name="mainRequest">
<wsdl:part name="parameters" element="ns:main"/>
</wsdl:message>
...
<wsdl:portType name="PositioningWebServicePortType">
<wsdl:operation name="main">
<wsdl:input message="ns:mainRequest" wsaw:Action="urn:main"/>
</wsdl:operation>
<wsdl:operation name="training">
<wsdl:input message="ns:trainingRequest" wsaw:Action="urn:training"/>
<wsdl:output message="ns:trainingResponse" wsaw:Action="urn:trainingResponse"/>
<wsdl:fault message="ns:IOException" name="IOException" wsaw:Action="urn:trainingIOException"/>
<wsdl:fault message="ns:SQLException" name="SQLException" wsaw:Action="urn:trainingSQLException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PositioningWebServiceSoap11Binding" type="ns:PositioningWebServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="main">
<soap:operation soapAction="urn:main" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
<wsdl:operation name="training">
<soap:operation soapAction="urn:training" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="IOException">
<soap:fault use="literal" name="IOException"/>
</wsdl:fault>
<wsdl:fault name="SQLException">
<soap:fault use="literal" name="SQLException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PositioningWebService">
</wsdl:service>
</wsdl:definitions>
You can see the operations or integrate the service in many ways. Here are a few approaches to get you started:
1) open the URL to the outputted WSDL with a web browser. You can look through it for all of the operation nodes. In these nodes you will see the parameters it requires and what to expect in the response.
2) use the data connectivity features in FlashBuilder. Select your project then choose Data -> Connect to web service... and follow the wizard which will import the WSDL and introspect the service for you. You will see all the operations etc then. They can then be used for data binding etc.
Here is a in-depth tutorial on using WSDLs , WebService components and even working with the operations and bindings. http://www.adobe.com/devnet/flex/videotraining/exercises/ex2_05_web.html