1. public void test3()
  2. {
  3. try
  4. {
  5. DefaultHttpClient httpClient = new DefaultHttpClient();
  6. URI uri = new URI("http://10.0.2.2/MicrosoftDynamicsAXAif60/testgroup/xppservice.svc");
  7.  
  8. // Send GET request to <service>/GetText
  9. HttpPost httpget = new HttpPost(uri);
  10. StringEntity se = null;
  11.  
  12. // declare it as XML
  13. se = new StringEntity(this.returnXML(), HTTP.UTF_8);
  14.  
  15. se.setContentType("text/xml");
  16. httpget.setHeader("Content-Type", "application/xml;charset=UTF-8");
  17. httpget.setEntity(se);
  18.  
  19. //NTCredentials nt = new NTCredentials("username", "pass", "", "domain");
  20. httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY, nt);
  21.  
  22.  
  23. HttpResponse response = httpClient.execute(httpget);
  24. HttpEntity responseEntity = response.getEntity();
  25.  
  26. // Read response data into buffer
  27. long intCount = responseEntity.getContentLength();
  28. char[] buffer = new char[(int)intCount];
  29. InputStream stream = responseEntity.getContent();
  30. InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
  31. try
  32. {
  33. reader.read(buffer);
  34.  
  35.  
  36. String str = new String(buffer);
  37. Toast.makeText(this, str, 10);
  38. }
  39.  
  40. catch (IOException e)
  41. {e.printStackTrace();}
  42. stream.close();
  43.  
  44.  
  45. }
  46. catch (Exception e) {e.printStackTrace();}
  47.  
  48. }
  49.  
  50. <?xml version="1.0" encoding="utf-8" ?>
  51. <configuration>
  52. <system.serviceModel>
  53. <bindings>
  54. <wsHttpBinding>
  55. <binding name="wsHttpBindingWithWindowsAuth">
  56. <security mode="TransportWithMessageCredential">
  57. <transport clientCredentialType="Windows" >
  58. <extendedProtectionPolicy protectionScenario="TransportSelected" policyEnforcement="Always" />
  59. </transport>
  60. <message clientCredentialType="Windows" />
  61. </security>
  62. </binding>
  63. </wsHttpBinding>
  64. <basicHttpBinding>
  65. <binding name="basicHttpBindingWithWindowsAuth">
  66. <security mode="TransportCredentialOnly">
  67. <transport clientCredentialType="Windows" />
  68. </security>
  69. </binding>
  70. </basicHttpBinding>
  71. <netTcpBinding>
  72. <binding name="DefaultServiceGroupBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="81920000" maxConnections="10" maxReceivedMessageSize="81920000">
  73. <readerQuotas maxDepth="32000000" maxStringContentLength="81920000" maxArrayLength="163840000" maxBytesPerRead="4096000" maxNameTableCharCount="16384000" />
  74. <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
  75. <security mode="Transport">
  76. <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
  77. <message clientCredentialType="Windows" />
  78. </security>
  79. </binding>
  80. </netTcpBinding>
  81. </bindings>
  82.  
  83. <services>
  84. <!--ROUTING SERVICE -->
  85. <!--Define a routing service. The Behavior Configuration field references the name of the Routing Behavior that this service will use-->
  86. <service name="System.ServiceModel.Routing.RoutingService" behaviorConfiguration="routingData">
  87. <!--
  88. Define and configure the endpoint we want the Router to listen on and the Contract we want it to use
  89. Router provided contracts are: ISimplexDatagramRouter, ISimplexSessionRouter, IRequestReplyRouter, and IDuplexSessionRouter.
  90. -->
  91. <endpoint address=""
  92. binding="basicHttpBinding"
  93. bindingConfiguration="basicHttpBindingWithWindowsAuth"
  94. name="reqReplyEndpoint"
  95. contract="System.ServiceModel.Routing.IRequestReplyRouter" >
  96. <identity>
  97. <servicePrincipalName />
  98. </identity>
  99. </endpoint>
  100. </service>
  101. </services>
  102.  
  103. <behaviors>
  104. <serviceBehaviors>
  105. <behavior name="routingData">
  106. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
  107. <serviceDebug includeExceptionDetailInFaults="False" />
  108. <!--
  109. Define the Routing Behavior. The routingTableName attribute contains the name of the Routing Table that this behavior will use.
  110. <routing filterTableName="AosRoutingTable" />
  111. -->
  112. </behavior>
  113. </serviceBehaviors>
  114.  
  115. <endpointBehaviors>
  116. <behavior name="clientEndpointBehavior">
  117. <clientEndpointBehavior />
  118. </behavior>
  119. </endpointBehaviors>
  120. </behaviors>
  121.  
  122. <extensions>
  123. <behaviorExtensions>
  124. <add
  125. name="clientEndpointBehavior"
  126. type="Microsoft.Dynamics.Ax.Services.Host.ClientEndpointBehaviorExtension, Microsoft.Dynamics.IntegrationFramework.WebService.Process, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  127. </behaviorExtensions>
  128. </extensions>
  129.  
  130. <!--
  131. Define the client endpoints that we want the Router to communicate with. These are the destinations that the Router will send messages to.
  132. Note that we always define the client endpoint contract as *. The router will mirror the selected contract defied on the endpoint
  133. on which the message was originally recieved.
  134. -->
  135. <client>
  136. <endpoint name="ServiceCustom" address="net.tcp://AOS_SERVICE_HOST/DynamicsAx/Services/testgroup" binding="netTcpBinding" bindingConfiguration="DefaultServiceGroupBinding" contract="*" behaviorConfiguration="clientEndpointBehavior">
  137. <identity><servicePrincipalName /></identity>
  138. </endpoint>
  139.  
  140. </client>
  141. <routing>
  142. <!--
  143. Define the filters that we want the router to use. In this example we define a MatchAll message filter, which will match all messages it sees.
  144. -->
  145. <filters>
  146. <filter name="MatchServiceCustom" filterType="Custom" customType="Microsoft.Dynamics.Ax.Services.Host.MatchAxServiceFilter, Microsoft.Dynamics.IntegrationFramework.WebService.Process" filterData="http://tempuri.org/ServiceCustom" />
  147.  
  148. </filters>
  149.  
  150. <!-- Define the routing table that contains the matchAll filter defined in the filters section. -->
  151. <filterTables>
  152. <filterTable name="AosRoutingTable">
  153. <!-- Map the filter to a client endpoint that was previously defined. Messages that match this filter will be sent to this destination. -->
  154. <add filterName="MatchServiceCustom" endpointName="ServiceCustom" />
  155.  
  156. </filterTable>
  157. </filterTables>
  158. </routing>
  159. </system.serviceModel>
  160. </configuration>
  161.  
  162. <s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  163. <s:Header>
  164. <a:Action>http://tempuri.org/ServiceCustom/CreateMyDataObject</a:Action>
  165. <h:CallContext i:nil="true" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://schemas.microsoft.com/dynamics/2010/01/datacontracts" />
  166. <a:MessageID>urn:uuid:c70fb5f6-1345-469d-84fd-bb24500d329a</a:MessageID>
  167. <a:ReplyTo>
  168. <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
  169. </a:ReplyTo>
  170. </s:Header>
  171. <s:Body>
  172. <ServiceCustomCreateMyDataObjectRequest xmlns="http://tempuri.org">
  173. <_s>23</_s>
  174. </ServiceCustomCreateMyDataObjectRequest>
  175. </s:Body>
  176. </s:Envelope>