I'm using Delphi XE7 + Employee Interbase DB.
I'm tryin to build a SOAP server with Datasnap.
I have 3 SOAP Server Data Modules in one server, each one with a table: Customer, Employee, Country, each one made the same way (File, new, other, SOAP Server Data Module), then from Data Explorer dragging a table on the data module (Delphi creates a TSQLCOnnection and a TSQLDataset), then adding a TDatasetProvider. The three Data Modules are identical.
In the client application i have three interfaces made by WSDL importer
ICountryWM = interface(IAppServerSOAP)
['{1DA001BC-4DFB-E7F8-F62D-DA3545B334DC}']
end;
The three interfaces are identical (of course names and GUIDS are different).
In the Client form i have three buttons, they doperform the same operations:
procedure TClientFM.BtnEmployeeClick(Sender: TObject);
begin
ClientDataSet.Close;
SoapConnection.Close;
SoapConnection.UseSOAPAdapter := False;
SoapConnection.SOAPServerIID := '{02E9AB9B-DB17-ACF5-68D9-73FC763C04DC}';
SoapConnection.URL := 'http://localhost:8080/soap/IEmployeeWM';
ClientDataset.ProviderName := 'EmployeeProvider';
SoapConnection.Open;
ClientDataSet.Open;
end;
only changing ServerID, URL, ProviderName.
The three DatasetProvider ini the three Data Module have "Exported" checked.
In the beginning the first SOAP Server Data Module (Customer) worked well: from my client i sawe the Customers table. When i tried Employee or Country, i always got "Provider not exported".
I made a BIG MISTAKE: trying to change something i unchecked the Exported flags, compiled and ran server and client: nothig worked.
Ok, i expected that.
Then I rechecked the flags ... now the Exported flags are checked but no one provider works correctly ... (yes, the one that worked now does not work).
Both Server and Client run in the same PC.
Can someone give me any idea of what is wrong?
I think the problem is in the server, but WHERE in the server?
Related
I need to build an interface between Dynamics NAV 2013 and Groupon API V2
It seems to me that Groupons API data comes in json format - how could I get this information in Dynamics NAV (orders for example) ?
Should I use webservices ?
Thanks
EDIT :
I worked a lot on this and got receiving data from groupon working
The problem is send information :
I have a problem to send a post request with parameters - this is my code :
WebServiceURL := 'https://...';
Request := Request.Create(WebServiceURL);
Request.Method := 'POST';
Request.KeepAlive := TRUE;
Request.Timeout := 30000;
Request.Accept('application/json');
Request.ContentType('multipart/form-data');
postString := 'param1=123¶m2=456';
Request.ContentLength := STRLEN(postString);
StreamWriter := StreamWriter.StreamWriter(Request.GetRequestStream);
StreamWriter.Write(postString);
StreamWriter.Close;
I get a 500 error so I don't know anything about why its rejected
But if there is something that seems to be wrong to you, please help !
the most NAV frienly way is to get the order in XML format from the API and import the XMLs using XMLports or Codeunits(use DotNet)
Cheers
You don't need Nav web services because in this case you are (Nav) the client side, when web services is to build the server side. E.g. you can call web service but web service can not call anything. Most probably you will use NAS to perform tasks periodically.
AFAIK Nav can't handle JSON, but in Nav2013 it's possible to use .Net libraries so just pick JSON library you like and call it from Nav to process responses from API.
To make calls(requests) to API you can use .net or com library of your choise just the same was as for JSON.
ReqXML : Automation 'Microsoft XML, v6.0'.DOMDocument60
RespXML: Automation 'Microsoft XML, v6.0'.DOMDocument60
Req : Automation 'Microsoft XML, v6.0'.XMLHTTP60
CREATE(Req, TRUE);
Req.open(reqType, Uri, FALSE);
Req.setRequestHeader('contentType', 'text/xml; charset=UTF-16');
CASE reqType OF
'GET': Req.send();
'POST': Req.send(ReqXML);
END;
RespText := Req.statusText;
IF Req.status <> 200 THEN EXIT(FALSE);
IF ISCLEAR(RespXML) THEN CREATE(RespXML, TRUE);
RespXML.load(Req.responseXML);
In this example request to address stored in Uri is made. If you need to post some data aside from URL parameters then you put it to ReqXML. If API is suppose to return something it will be inside RespXML.
This code works for older versions of Nav. You will have to rewrite it a little to use .Net libraries (like webclient) and maybe get rid of XML (in my case API was XML based) but the structure will be pretty much the same.
Is it possible to connect to a web service (for example send a HTTP Request) via VBA in Microsoft Access?
For example, the user clicks a button on a form, then a HTTP Request is sent to a web service that responds with OK.
Has anyone done this before?
Note: VBA, not VB.NET.
This is code I've used quite successfully with Access 2003. It's from the interwebs, copied and re-copied ages ago. It creates a XMLHttpRequest Object, sends an HTTP GET request, and returns the results as a string.
Public Function http_Resp(ByVal sReq As String) As String
Dim byteData() As Byte
Dim XMLHTTP As Object
Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")
XMLHTTP.Open "GET", sReq, False
XMLHTTP.send
byteData = XMLHTTP.responseBody
Set XMLHTTP = Nothing
http_Resp = StrConv(byteData, vbUnicode)
End Function
sReq is the URL; the function returns the response. You may need to make sure ActiveX Data Objects are enabled under your References (in the VBA editor, go to Tools > References).
This is the code , which I used. You need to first reference Microsoft XML V6 for this code to work.
Public Sub GetPerson()
'For API
Dim reader As New XMLHTTP60
reader.Open "GET", "www.exmple.com/users/5428a72c86abcdee98b7e359", False
reader.setRequestHeader "Accept", "application/json"
reader.send
Do Until reader.ReadyState = 4
DoEvents
Loop
If reader.Status = 200 Then
Msgbox (reader.responseText)
Else
MsgBox "Unable to import data."
End If
End Sub
I have used the "Microsoft Office 2003 Web Services Toolkit 2.01" toolkit (available here) on a few projects. It worked pretty well for me, although I also wrote the web services it was talking to, so I had the luxury of being able to fiddle with both ends of the process when getting it to actually work. :)
In fact, I just upgraded one of those apps from Access_2003 to Access_2010 and the SOAP client part of the app continued to work without modification. However, I did encounter one wrinkle during pre-deployment testing:
My app would not compile on a 64-bit machine running 32-bit Office_2010 because it did not like the early binding of the SoapClient30 object. When I switched to using late binding for that object the code would compile, but it did not work. So, for that particular app I had to add a restriction that 64-bit machines needed to be running 64-bit Office.
Also, be aware that Microsoft's official position is that "All SOAP Toolkits have been replaced by the Microsoft .NET Framework." (ref. here).
I am new to the wsdl\soapmessage query\reply world( if i can put it in this way), and I am facing some difficulties using the following wsdl( which I really really hope, one will be so kind to look at at least one of the services described there)
http://almdemo.polarion.com/polarion/ws/services/TrackerWebService?wsdl
which was provided to me to develop a matlab webinterface. Right now my matlab code looks like this:
targetNamespace = 'http://ws.polarion.com/TrackerWebService';
method = 'queryWorkItems';
values= {'Query','Sort'}
names = {'query', 'sort'}
types ={'xsd:string','xsd:string'}
message = createSoapMessage( targetNamespace, method, values, names, types)
response = callSoapService('http://almdemo.polarion.com/polarion/ws/services',...
% Service's endpoint
'http://almdemo.polarion.com/polarion/#/workitems',...
% Server method to run
message)
% SOAP message created using createSoapMessage
author = parseSoapResponse(response)
Herewith to save you time I will just enonce my two problems:
Is the code correct?
Could someone tell me if such a wsdl link is just a definition of webservices or it is also a service's endpoint?
Normally to execute manually\per clicks this services on the weppage
http://almdemo.polarion.com/polarion, you have to login!
So how do I send a message in matlab which first log me in? Or must such a service be introduced into that wsdl for me to do it?? Could you be kind enough to write how it must be defined, because I don't really
write wsdl files, but I shall learn!**
I will be really thankful for your help and I wish you a happy week(-end) guys(& girls)!!!
Regards
Chrysmac
ps: I tried to use Soapui and gave that webpage as endpoint, but the toool crashes each time I enter my credentials! Maybe because of the dataload!??
This is probably a very simple question but I just can't seem to figure it out.
I am writing a Javascript app to retrieve layer information from a WFS server using a GetCapabilities request using GeoExt. GetCapabilities returns information about the WFS server -- the server's name, who runs it, etc., in addition to information on the data layers it has on offer.
My basic code looks like this:
var store = new GeoExt.data.WFSCapabilitiesStore({ url: serverURL });
store.on('load', successFunction);
store.on('exception', failureFunction);
store.load();
This works as expected, and when the loading completes, successFunction is called.
successFunction looks like this:
successFunction = function(dataProxy, records, options) {
doSomeStuff();
}
dataProxy is a Ext.data.DataProxy object, records is a list of records, one for each layer on the WFS server, and options is empty.
And here is where I'm stuck: In this function, I can get access to all the layer information regarding data offered by the server. But I also want to extract the server information that is contained in the XML fetched during the store.load() (see below). But I can't figure out how to get it out of the dataProxy object, where I'm sure it must be squirreled away.
Any ideas?
The fields I want are contained in this snippet:
<ows:ServiceIdentification>
<ows:Title>G_WIS_testIvago</ows:Title>
<ows:Abstract/>
<ows:Keywords>
<ows:Keyword/>
</ows:Keywords>
<ows:ServiceType>WFS</ows:ServiceType>
<ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion>
<ows:Fees/>
<ows:AccessConstraints/>
Apparently,GeoExt currently discards the server information, undermining the entire premise of my question.
Here is a code snippet that can be used to tell GeoExt to grab it. I did not write this code, but have tested it, and found it works well for me:
https://github.com/opengeo/gxp/blob/master/src/script/plugins/WMSSource.js#L37
I need to set a global parameter in the Webmodule of my Delphi CGI webservice so that I can use it throughout the life of the request as a unique identifier (traceId) for logging purposes. The unique identifier needs to be generated in the Webmodule because the first thing I log is the raw XML that is received. I then log all sorts of debug information in my actual web service methods and I needs the Id to tie these all together.
I can't figure out a way to do this. The actual Webmodule is not accessible in my webservice methods and any attempts just throw an access violation. I'm probably doing this in completely the wrong way but I can think of another solution.
Any ideas?
Assuming you're talking about a SOAP webservice, you can use GetSOAPWebModule to get a reference to your web module from within your service method.
Example:
uses
WebBrokerSOAP, MyWebModuleUnit;
procedure TMyService.MyMethod;
var
MyWebModule: TMyWebModule;
TraceID: Integer;
begin
MyWebModule := GetSOAPWebModule as TMyWebModule;
TraceID := MyWebModule.TraceID;
end;