Webservice Macro Example - using net.tcp binding

From Smartsite iXperion 1.2 onward, the webservice macro now also supports net.tcp bindings. The module just checks the specified url, and if it starts with "net.tcp" the module automatically switches to a NetTcpBinding internally.

NetTcpBindings are much faster than a standard http binding. So, when a connection to a (web)service, which is available within the LAN, must be established, a NetTcpBinding is the more logical choice. NetTcpBindings usually are configured using the machinename as part of the address, and are usually not accessible from outside the LAN.

The example below connects to the (Smartsite internal) InteropService, using a net.tcp binding. Notice however, that you should adjust the web.config if you want to try out this example, since normally the InteropService doesn't start a net.tcp listener, only a named pipe listener (net.pipe).

The excerpt from an adjusted web.config shown below, shows you how to add a net.tcp listener.

XML CopyCode image Copy Code
<services>
 <!-- other services omitted -->
 <service name="Smartsite.Core.Services.InteropService" 
        behaviorConfiguration="InteropServiceBehavior">
  <endpoint address="net.pipe://localhost/emptysix-11/InteropService" 
    binding="netNamedPipeBinding" bindingConfiguration="InteropServiceBinding" 
    contract="Smartsite.Core.Services.IInteropService"/>
  <endpoint address="net.tcp://[machinename]/emptysix-11/InteropService" 
    binding="netTcpBinding" bindingConfiguration="TcpInteropServiceBinding" 
    contract="Smartsite.Core.Services.IInteropService"/>
 </service>
</services>
<bindings>
 <!-- other binding configuration nodes omitted -->
 <netNamedPipeBinding>
  <binding name="InteropServiceBinding" maxReceivedMessageSize="1048576">
   <readerQuotas maxStringContentLength="1048576"/>
  </binding>
 </netNamedPipeBinding>
 <netTcpBinding>
  <binding name="TcpInteropServiceBinding" maxReceivedMessageSize="1048576">
   <readerQuotas maxStringContentLength="1048576"/>
  </binding>
 </netTcpBinding>
</bindings>

Notice, that [machinename] must be replaced with the appropriate machinename. Also, the webservice macro example uses localhost within the url parameter, and this should be changed to the appropriate machinename as well.

Smartsite SXML CopyCode image Copy Code
<se:webservice>
    <se:parameters>
        <se:parameter name="url">net.tcp://localhost/emptysix-11/InteropService</se:parameter>
        <se:parameter name="methodname">GetSystemInformation</se:parameter>
        <se:parameter name="soapaction">http://Smartsite.Services.InteropService/InteropService/GetSystemInformation</se:parameter>
        <se:parameter name="methodnamespace">http://Smartsite.Services.InteropService</se:parameter>
        <se:parameter name="methodarguments">
            <se:collection>
                <se:member name="formatAsHtml">true</se:member>
            </se:collection>
        </se:parameter>
        <se:parameter name="outputinnertext">true</se:parameter>
    </se:parameters>
</se:webservice>