0

I did a web service with in Java using Apache tomcat and axis 2 ( I am working with ubuntu) this web service calls some programs and works pretty fine in localhost ( I check it by running a web service client also built in Java). now I would like to publish it using Ngrok. This is the code that I use:

ngrok http 8080

and I get the link from de ngrok and I can access to my web service wsdl from anywhere

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://ws.apache.org/axis2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" targetNamespace="http://ws.apache.org/axis2">
<wsdl:documentation>Please Type your service description here</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws.apache.org/axis2">
<xs:element name="AddClassException">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="AddClassException" nillable="true" type="ns:Exception"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Exception">
<xs:sequence>
<xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="cNNPredict">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Image" type="xs:int"/>
<xs:element name="Height" type="xs:int"/>
<xs:element name="Width" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cNNPredictResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Add">
<xs:complexType>
<xs:sequence>
<xs:element name="x" type="xs:int"/>
<xs:element name="y" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AddResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="AddRequest">
<wsdl:part name="parameters" element="ns:Add"/>
</wsdl:message>
<wsdl:message name="AddResponse">
<wsdl:part name="parameters" element="ns:AddResponse"/>
</wsdl:message>
<wsdl:message name="cNNPredictRequest">
<wsdl:part name="parameters" element="ns:cNNPredict"/>
</wsdl:message>
<wsdl:message name="cNNPredictResponse">
<wsdl:part name="parameters" element="ns:cNNPredictResponse"/>
</wsdl:message>
<wsdl:message name="AddClassException">
<wsdl:part name="parameters" element="ns:AddClassException"/>
</wsdl:message>
<wsdl:portType name="AddClassPortType">
<wsdl:operation name="Add">
<wsdl:input message="ns:AddRequest" wsaw:Action="urn:Add"/>
<wsdl:output message="ns:AddResponse" wsaw:Action="urn:AddResponse"/>
</wsdl:operation>
<wsdl:operation name="cNNPredict">
<wsdl:input message="ns:cNNPredictRequest" wsaw:Action="urn:cNNPredict"/>
<wsdl:output message="ns:cNNPredictResponse" wsaw:Action="urn:cNNPredictResponse"/>
<wsdl:fault message="ns:AddClassException" name="AddClassException" wsaw:Action="urn:cNNPredictAddClassException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AddClassSoap11Binding" type="ns:AddClassPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="Add">
<soap:operation soapAction="urn:Add" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="cNNPredict">
<soap:operation soapAction="urn:cNNPredict" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="AddClassException">
<soap:fault use="literal" name="AddClassException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="AddClassSoap12Binding" type="ns:AddClassPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="Add">
<soap12:operation soapAction="urn:Add" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="cNNPredict">
<soap12:operation soapAction="urn:cNNPredict" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="AddClassException">
<soap12:fault use="literal" name="AddClassException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="AddClassHttpBinding" type="ns:AddClassPortType">
<http:binding verb="POST"/>
<wsdl:operation name="Add">
<http:operation location="Add"/>
<wsdl:input>
<mime:content type="application/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="application/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="cNNPredict">
<http:operation location="cNNPredict"/>
<wsdl:input>
<mime:content type="application/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="application/xml" part="parameters"/>
</wsdl:output>
<wsdl:fault name="AddClassException"/>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AddClass">
<wsdl:port name="AddClassHttpSoap11Endpoint" binding="ns:AddClassSoap11Binding">
<soap:address location="http://f05fdcd1.ngrok.io:8080/AddOperator/services/AddClass.AddClassHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="AddClassHttpSoap12Endpoint" binding="ns:AddClassSoap12Binding">
<soap12:address location="http://f05fdcd1.ngrok.io:8080/AddOperator/services/AddClass.AddClassHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="AddClassHttpEndpoint" binding="ns:AddClassHttpBinding">
<http:address location="http://f05fdcd1.ngrok.io:8080/AddOperator/services/AddClass.AddClassHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

if I access to the URL from other PC i see some movement on the Ngrok screen Then I Add the web reference to my Xamarin APP and It loads with no problems Even i can see all the methods of my web service. Aparently everything works fine, but when I run My app there is no responce from the server , and also there is not movement in the ngrok screen ( I am 100% im calling the web service well ). Im so sure because I call other services with the exact same code.

What is going on ?

Nicole Ramírez
  • 345
  • 3
  • 19
  • are you using localhost, or the IP/FQDN of the server? – Jason Apr 26 '17 at 00:45
  • the server is running on LocalHost port 8080 , It sound weird , but I had this working last week and I have not made any changes on the code – Nicole Ramírez Apr 26 '17 at 01:21
  • localhost on your Android device/emulator will point back to itself, not the server it is running on (unless you have some network mapping enabled) so it's best not to use that for testing. Use the IP instead. – Jason Apr 26 '17 at 01:45
  • No wait I am not running in any emulator, im running it in my device – Nicole Ramírez Apr 26 '17 at 02:01
  • As I said, localhost on the device will point back to the device, not your PC. – Jason Apr 26 '17 at 02:07
  • No perheps you did no understand the web service runs in localhost but ngrok makes a tunnel from it a URL just like this: http://f05fdcd1.ngrok.io/AddOperator/services/AddClass?wsdl and that is the URL that I add ass web reference on my xamarin project – Nicole Ramírez Apr 26 '17 at 02:22

0 Answers0