Results 1 to 8 of 8

Thread: Help on Web Service

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862

    Help on Web Service

    Hi all,
    I'm a very newbie with web service.

    I've created a webservice on MS Dynamics AX.
    Ive create a simple call from Visual studio and c# following a sample on the WEB:
    http://axwonders.blogspot.com/2012/0...uming.html?m=1

    If I call the service from iExplorer with

    http://ax2012r2a:8101/DynamicsAx/Ser...ceGroupCGK5188

    I get:
    HTML Code:
      <?xml version="1.0" encoding="utf-8" ?> 
    - <wsdl:definitions name="GeneralInputOutputServiceGroupCGK5188" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:i0="GeneralInputOutputServiceCGK5188" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" 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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    - <wsp:Policy wsu:Id="NetTcpBinding_GeneralInputOutputServiceCGK5188_policy">
    - <wsp:ExactlyOne>
    - <wsp:All>
      <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" /> 
    - <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
    - <wsp:Policy>
    - <sp:TransportToken>
    - <wsp:Policy>
    - <msf:WindowsTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy">
      <msf:ProtectionLevel>EncryptAndSign</msf:ProtectionLevel> 
      </msf:WindowsTransportSecurity>
      </wsp:Policy>
      </sp:TransportToken>
    - <sp:AlgorithmSuite>
    - <wsp:Policy>
      <sp:Basic256 /> 
      </wsp:Policy>
      </sp:AlgorithmSuite>
    - <sp:Layout>
    - <wsp:Policy>
      <sp:Strict /> 
      </wsp:Policy>
      </sp:Layout>
      </wsp:Policy>
      </sp:TransportBinding>
      <wsaw:UsingAddressing /> 
      </wsp:All>
      </wsp:ExactlyOne>
      </wsp:Policy>
      <wsdl:import namespace="GeneralInputOutputServiceCGK5188" location="http://ax2012r2a:8101/DynamicsAx/Services/GeneralInputOutputServiceGroupCGK5188?wsdl=wsdl0" /> 
      <wsdl:types /> 
    - <wsdl:binding name="NetTcpBinding_GeneralInputOutputServiceCGK5188" type="i0:GeneralInputOutputServiceCGK5188">
      <wsp:PolicyReference URI="#NetTcpBinding_GeneralInputOutputServiceCGK5188_policy" /> 
      <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" /> 
    - <wsdl:operation name="Execute">
      <soap12:operation soapAction="GeneralInputOutputServiceCGK5188/GeneralInputOutputServiceCGK5188/Execute" style="document" /> 
    - <wsdl:input name="GeneralInputOutputServiceCGK5188ExecuteRequest">
      <soap12:header message="i0:GeneralInputOutputServiceCGK5188ExecuteRequest_Headers" part="context" use="literal" /> 
      <soap12:body use="literal" /> 
      </wsdl:input>
    - <wsdl:output name="GeneralInputOutputServiceCGK5188ExecuteResponse">
      <soap12:body use="literal" /> 
      </wsdl:output>
    - <wsdl:fault name="AifFaultFault">
      <soap12:fault name="AifFaultFault" use="literal" /> 
      </wsdl:fault>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="GeneralInputOutputServiceGroupCGK5188">
    - <wsdl:port name="NetTcpBinding_GeneralInputOutputServiceCGK5188" binding="tns:NetTcpBinding_GeneralInputOutputServiceCGK5188">
      <soap12:address location="net.tcp://ax2012r2a:8201/DynamicsAx/Services/GeneralInputOutputServiceGroupCGK5188" /> 
    - <wsa10:EndpointReference>
      <wsa10:Address>net.tcp://ax2012r2a:8201/DynamicsAx/Services/GeneralInputOutputServiceGroupCGK5188</wsa10:Address> 
    - <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
      <Upn>admin@contoso.com</Upn> 
      </Identity>
      </wsa10:EndpointReference>
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>
    How can I try to call it from Lianja?

    thanks
    Fabio

  2. #2
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    PS: the c# code is:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApplicationGeneric
    {
        class Program
        {
            static void Main(string[] args)
            {
                ServiceReferenceGeneric.GeneralInputOutputServiceCGK5188Client client = new ServiceReferenceGeneric.GeneralInputOutputServiceCGK5188Client();
    
                string ret = client.Execute(null, "ProdRouteTest");
    
    
                if (ret == "Ok")
                    Console.WriteLine("Vero");
    
                
    
            }
        }
    }

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,726
    Use a networkrequest with postfile or postdata
    https://www.lianja.com/doc/index.php/NetworkRequest
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    thanks Barry
    I've try...

    but this is the result:
    Name:  2020-01-25 16_54_51-Clipboard.jpg
Views: 33
Size:  85.2 KB

    what can I try to do?
    thanks
    Fabio

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,726
    Firstly, you have a typo. getData not gettdata.

    Read the doc again and you will better understand what the arguments should be.

    Normally you POST the web server request in XML and read the response. You can only POST content using postFile() or postData(). The output filename will contain the result from the post operation if it is successful.

    You cannot POST data with an http GET other than in the arguments using ?name=value...

    You should read up about how to call those webservices too. This is going to be specific to your web service.
    Last edited by barrymavin; 2020-01-25 at 19:50.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    Hi Barry, thanks.. I'm very very newbie..

    My Web service have a function: "Execute" and this get a string as a parameter and return a string.

    This is the web service open by ie:
    Name:  2020-01-27 08_19_43-Clipboard.jpg
Views: 23
Size:  72.4 KB

    and this the app.config..
    Name:  2020-01-27 08_23_50-Clipboard.png
Views: 23
Size:  27.2 KB

    thanks again

  7. #7
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,933
    Hi Phabio,

    There are two parts to accessing a web service. One is: how to make the HTTP part of the process work. Barry answered that. Two is: what is the content of what I send and receive? The latter part is particular to the web service you are using. That is what Barry said you would have to study.

    Note that you are referring to the older SOAP API. A Google Search for "Dynamics AX rest api" came up with https://docs.microsoft.com/en-us/dyn...management-api . REST api's are much easier to work with. Check that out. If you need a consultant on either API, SOAP or REST, there are many sites on the web where you can contract with experts in almost any given content area.

    Hank

  8. #8
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,862
    Thanks Hank,
    the problem is to found the right sample.. :-)

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us