so through soapui, you can send a string to 8082, 8080, 8081..

but through suds using the HTTPS connection... you can't?

You have a connection refusal error... either the port is blocked or some connection isn't correctly specified..
although in an earlier email it seems your service bindings have ports attached to the url..


On Tue, Jun 18, 2013 at 12:02 PM, Surya Kasturi <suryak@ieee.org> wrote:



On Tue, Jun 18, 2013 at 7:00 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
If there's a connection refusal error it could be that the port you're trying to access on the server is blocked..
or your credentials are incorrect... are you able to access port 443 (for HTTPS) or port 80 (for HTTP)?


On Mon, Jun 17, 2013 at 5:28 AM, Surya Kasturi <suryak@ieee.org> wrote:
Hi, You were right on the dot.. There was a problem with Server which I fixed it and tested using soapui and its working.

Now, I am running the script but the problem is still there.
The below is the traceback!!

  File "/media/sf_surya-workspace/SumoVehicleGPSLoggerPython/src/SoapAttachment.py", line 70, in with_soap_attachment
    response = suds_method.client.options.transport.send(request)

  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/https.py", line 64, in send
    return  HttpTransport.send(self, request)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 77, in send
    fp = self.u2open(u2request)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 118, in u2open
    return url.open(u2request, timeout=tm)
  File "/usr/lib/python2.7/urllib2.py", line 401, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 419, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1211, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1181, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>


The following headers I have mentioned explicitly in soapui

Content-Type: text/xml; charset=UTF8


This is the response headers from soapui

Transfer-Encoding    chunked
Date    Mon, 17 Jun 2013 08:46:01 GMT
#status#    HTTP/1.1 200 OK
Content-Type    multipart/related; boundary="MIMEBoundary_f3eeffa96390b51859789ae9a2d4ade84a7dcf209ffe1c2d"; type="text/xml"; start="<0.e3eeffa96390b51859789ae9a2d4ade84a7dcf209ffe1c2d@apache.org>"
Server    Apache-Coyote/1.1


I dont know where the problem and why is it happening with this script..


Thanks
Surya


On Thu, Jun 13, 2013 at 6:53 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
You should send the file as open(filepath, "rb").read() as you are sending it in an HTTP request... on the server side it should expecting that field to be a file though


On Thu, Jun 13, 2013 at 11:35 AM, Surya Kasturi <suryak@ieee.org> wrote:



On Thu, Jun 13, 2013 at 5:56 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:


---------- Forwarded message ----------
From: Matthew Ashton <matthew.ashton3@gmail.com>
Date: Thu, Jun 13, 2013 at 10:55 AM
Subject: Re: [Fedora-suds-list] Location attribute not found error
To: Surya Kasturi <kasturisurya@gmail.com>


It sounds like you may need to check the server that handles these SOAP calls.

Perhaps you could see that requests / responses come through by checking the client object after making a request, you print client.last_sent() and client.last_received()

also, if you need to debug what suds is sending, it sounds like a great opportunity to look in the debug section of the documentation https://fedorahosted.org/suds/wiki/Documentation#LOGGING

looks like enabling the suds.transport logging would help a lot


On Thu, Jun 13, 2013 at 3:45 AM, Surya Kasturi <kasturisurya@gmail.com> wrote:



On Wed, Jun 12, 2013 at 5:26 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
Wait, this line (it's line 75 in the unmodified file)
request = Request(suds_method.client.location, request_text)

needs to become

request = Request(suds_method.method.location, request_text)

because the location attribute is under the method attribute... of the suds method.

The script was written 3 years ago so having things change over time makes sense.


On Wed, Jun 12, 2013 at 4:24 AM, Surya Kasturi <kasturisurya@gmail.com> wrote:



On Wed, Jun 12, 2013 at 12:57 AM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
line 75 of https://fedorahosted.org/suds/attachment/ticket/350/soap_attachments.2.py
says

request = Request(suds_method.client.location(), request_text)

well the suds method (Which would be c.service.something) doesn't have a location attribute under client.
instead it is under method, so it should be

request = Request(suds_method.method.location, request_text)


On Tue, Jun 11, 2013 at 5:47 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
No... see the documentation. I just wanted to make sure the client objects was set up... so something like
from suds.client import Client
url="./abc?wsdl"
self.client = Client(url=url)

works.


location
This overrides the service port address URL defined in the WSDL.

The service port address defined in the WSDL should look like (here is from fedex's testing wsdl)

  <service name="ShipService">
    <port name="ShipServicePort" binding="ns:ShipServiceSoapBinding">
      <s1:address location="https://wsbeta.fedex.com:443/web-services/ship"/>
    </port>
  </service>

and I know why it's failing.. it's because there's no .location() under a client (line 75)... and I'm trying to find where you can access it


On Tue, Jun 11, 2013 at 1:01 PM, Surya Kasturi <kasturisurya@gmail.com> wrote:



On Tue, Jun 11, 2013 at 7:42 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
location is a keyword argument attribute you can specify at the creation of the client object used to make the service calls, or change later through a method call setlocation ( http://jortel.fedorapeople.org/suds/doc/suds.wsdl.Service-class.html )

According to the suds documentation ( https://fedorahosted.org/suds/wiki/Documentation )
location
This overrides the service port address URL defined in the WSDL.
So I was just making sure you set up the client object properly


On Tue, Jun 11, 2013 at 12:25 PM, Surya Kasturi <kasturisurya@gmail.com> wrote:



On Tue, Jun 11, 2013 at 7:21 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
But the question was what did you do to fix the 'location' issue?


On Tue, Jun 11, 2013 at 12:12 PM, Surya Kasturi <kasturisurya@gmail.com> wrote:
Thanks...
We have used a similar method to send data as string and its working! But the string is of size 250kb and we don't want that large data to be sent as a single string


On Tue, Jun 11, 2013 at 5:27 PM, Matthew Ashton <matthew.ashton3@gmail.com> wrote:
I'm assuming you've properly set up the client to make the web service call? I'll look into the ticket you linked.

On Tue, Jun 11, 2013 at 7:43 AM, Surya Kasturi <kasturisurya@gmail.com> wrote:
I am using with_soap_attachment() mentioned at https://fedorahosted.org/suds/ticket/350

    def sendFile(self, vehicleId, filePath):
        uploadFileMethod = self.client.service.uploadFile
        attachment_id = hashlib.sha256(filePath).hexdigest()
        attachment_content = (filePath, attachment_id)
        with_soap_attachment(uploadGpxFileMethod, attachment_content)

this what my method is..

Now, I am getting the error

AttributeError: 'Client' object has no attribute 'location'
Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown

SoapAttachment.py", line 75, in with_soap_attachment

So, how to fix it?? I need to attach file and send it..As this interface needs to be done asap it would be nice if someone can let me know what is the issue here

thanks


_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds




the location attribute line was something like

suds_method.client.location() which is supposed to work and since the attr is not present, its raising.

So, I manually edited that argument and replaced with the server wsdl url
( I am quite new in the team and new to soap.. I hope its right!! putting wsdl url)

but, after that its raising error. "internal server fault" or something.. I am away from the codebase now and thus can't give you appropriate details :( 


Okay, as far as I remember (I don't have code base right now)

the Client instance is created like this

url = "localhost://...//abc?wsdl"
self.client = Client(url)

and you are saying that we can do something like

self.client = Client(location = url)






First let me give you some clear picture!

The client program (Python) instance is something like this

    def __init__(self):
        self.initClient()
   
    def initClient(self):
        try:
            self.client = Client(url)
        except:
            ..

This is where I am actually calling the remote method

def sendLogFile(self, filePath):
        import hashlib

        uploadFileMethod = self.client.service.uploadFile
        attachment_id = hashlib.sha256(filePath).hexdigest()
        attachment_mimetype = "text/plain"
        attachment_content = (filePath, attachment_id, attachment_mimetype)
        with_soap_attachment(uploadFileMethod, attachment_content)

This is raising


AttributeError: 'Client' object has no attribute 'location'
Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).

On the server side, which is written in JSP, has a method

String uploadFile(File logFile);

and the WSDL definitions something like below

<wsdl:service name="WebService">
    <wsdl:port name="WebServiceHttpSoap11Endpoint" binding="ns:WebServiceSoap11Binding">
       <soap:address location="http://localhost:8080/myserver/services/WebService.WebServiceHttpSoap11Endpoint/"/>
    </wsdl:port>
   <wsdl:port name="WebServiceHttpSoap12Endpoint" binding="ns:WebServiceSoap12Binding">
       <soap12:address location="http://localhost:8080/myserver/services/WebService.WebServiceHttpSoap12Endpoint/"/>
   </wsdl:port> 
  <wsdl:port name="WebServiceHttpEndpoint" binding="ns:WebServiceHttpBinding">
     <http:address location="http://localhost:8080/myserver/services/WebService.WebServiceHttpEndpoint/"/>
   </wsdl:port>
</wsdl:service>


I guess I have created the Client() instance succesfully but its raising the above mentioned errors.


As per your previous message, I even changed the line 77 in with_soap_attachment to

request = Request(suds_method.client.location, request_text)


Thanks for your valuable time.



Hey, thanks.. but there seems to be other errors raising too.

This is the method I am running

def sendFile(self, filePath):
        uploadFileMethod = self.client.service.uploadFile
        attachment_id = uuid.uuid4()
        attachment_mimetype = "text/plain"
        attachment_content = (open(filePath, "rb"), attachment_id, attachment_mimetype)
        with_soap_attachment(uploadFileMethod, attachment_content)

I am getting this error

 File "soap_attachments.py", line 69, in with_soap_attachment
    '--%s--' % boundary_id
TypeError: sequence item 6: expected string, file found


My remote method is this

String uploadFile(File my_file);

I don't understand why its not taking the file object


But, anyway, I changed the method above mentioned line5 to

attachment_content = (open(filePath, "rb").read(), attachment_id, attachment_mimetype)

The below line sends the string!!

Now, I am getting this error

  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/https.py", line 64, in send
    return  HttpTransport.send(self, request)
  File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/transport/http.py", line 85, in send
    raise TransportError(e.msg, e.code, e.fp)
suds.transport.TransportError: Internal Server Error

Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).


Thanks a lot for your time!!

Surya



_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds

Okay..

One think I notice is that, when ever I invoke the client method, I see some log going on the Server side... I guess, the method is invoking the server..
The below is the error on server side..

can you tell me onething..

should I send file as

open(filepath, "rb") --or
open(filepath, "rb").read() ---> this one string.. how can we assume as attachment.

[ERROR] org/apache/james/mime4j/MimeException
java.lang.NoClassDefFoundError: org/apache/james/mime4j/MimeException
    at org.apache.axiom.attachments.Attachments.<init>(Attachments.java:93)
    at org.apache.axis2.builder.BuilderUtil.createAttachments(BuilderUtil.java:592)
    at org.apache.axis2.builder.BuilderUtil.createAttachmentsMap(BuilderUtil.java:543)
    at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:39)
    at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179)
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.apache.james.mime4j.MimeException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    ... 22 more
[ERROR] org/apache/james/mime4j/MimeException
java.lang.NoClassDefFoundError: org/apache/james/mime4j/MimeException
    at org.apache.axiom.attachments.Attachments.<init>(Attachments.java:93)
    at org.apache.axis2.builder.BuilderUtil.createAttachments(BuilderUtil.java:592)
    at org.apache.axis2.builder.BuilderUtil.createAttachmentsMap(BuilderUtil.java:543)
    at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:39)
    at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179)
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.apache.james.mime4j.MimeException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    ... 22 more


_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds



8082 8080 8081

I am actually able to send strings..