SQL Server Web Service.

7
I have been trying to create a simple test web service on my SQL Server 2005 database. I created a procedure to retrieve the data i wanted and then i created an endpoint for the web service. This is the code i used: CREATE ENDPOINT GetStores STATE = STARTED AS HTTP( PATH = '/Store', AUTHENTICATION = (INTEGRATED), PORTS = (CLEAR), SITE = 'nlbmrasql1') FOR SOAP( WEBMETHOD 'StoreList' (NAME='AdventureWorks.dbo.SalesStoreProc'), BATCHES = DISABLED, WSDL = DEFAULT, DATABASE = 'AdventureWorks', NAMESPACE = 'http://AdventureWorks/Store') GO I then tested my web service with xml spy and it was able to access the WSDL using the address: http://nlbmrasql1/Store?wsdl When i try to import into mendix using the same address it complains giving me the following error: System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) at System.Net.WebClient.DownloadString(Uri address) at System.Net.WebClient.DownloadString(String address) at Mendix.Modeler.WebServices.WsdlInfo.BuildContents(String url, List1 messages) at Mendix.Modeler.WebServices.WsdlInfo.FromUrl(String url, List1 messages) at Mendix.Modeler.WebServices.WsdlFileEditor.<>cDisplayClass1.<tryimportwsdl>b0(WorkerTaskInfo info) at Mendix.Utility.WorkerTask.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) I think this is due to the fact that i have used INTEGRATED security and i guess that mendix does not support this. How do i get around this? Thanks
asked
4 answers
8

The modeler doesn't support any type of authentication. However, to circumvent this, you could copy/paste the WSDL from Internet Explorer, save it as a file, and then import that from the modeler.

For details on how to import WSDLs from your computer, see this question

The alternative would be to write a database parser, run that from a java action and import stuff directly (ie without webservices)

answered
6

Currently authentication with retrieving webservices is not supported. In my opinion the authentication should always be done in interface, during consuming, if needed. Version 2.5 has more features available related to webservices.

answered
3

I got it to import the file using the following file:///C:/Store.wsdl. However it now says that the WSDL is not valid! I Now get the following error:

System.Xml.Schema.XmlSchemaException: The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared. at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e) at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity) at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e) at System.Xml.Schema.Compiler.CompileElement(XmlSchemaElement xe) at System.Xml.Schema.Compiler.CompileParticleElements(XmlSchemaComplexType complexType, XmlSchemaParticle particle) at System.Xml.Schema.Compiler.CompileParticleElements(XmlSchemaComplexType complexType, XmlSchemaParticle particle) at System.Xml.Schema.Compiler.CompileComplexTypeElements(XmlSchemaComplexType complexType) at System.Xml.Schema.Compiler.Compile()
at System.Xml.Schema.Compiler.Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo) at System.Xml.Schema.XmlSchemaSet.Compile() at Mendix.Modeler.WebServices.WsdlImports..ctor(ServiceDescription baseWsdl, List1 wsdls) at Mendix.Modeler.WebServices.WsdlInfo.ResolveImports(ServiceDescription desc, String url) at Mendix.Modeler.WebServices.WsdlInfo.BuildContents(String url, List1 messages) at Mendix.Modeler.WebServices.WsdlInfo.FromUrl(String url, List`1 messages) at Mendix.Modeler.WebServices.WsdlFileEditor.<>cDisplayClass1.<tryimportwsdl>b0(WorkerTaskInfo info) at Mendix.Utility.WorkerTask.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

I am guessing there is something wrong with the WSDL file. Do i have to declare one of the schema's or something.

I think this is the section that is causing the problem:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" attributeFormDefault="qualified" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes">
answered
0

Thanks for all the feedback, Simon. I've quickly looked at the WSDL and it seems as though the modeler should be able to handle it. Would you mind sending in a bug report at MXDN? A copy of the WSDL would be appreciated. (in the bugreport ;))

answered