You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tim Stephenson <ti...@thestephensons.me.uk> on 2003/06/05 11:28:40 UTC

Mail transport question

Hi,

apologies if there is stuff in the mailing list already but searching for
the word mail appears to return everything - not surprising really i guess

i am trying to put together a small example of using a mail transport using
the tcp example as a template. I have got it working but experienced a
couple of issues i'd appreciate advice on

My first attempt at a DII call resulted in 'targetService is null' fault
being returned. Fair enough the target service in the message context is
indeed null but where should this have been set? Here is the call creation

      /* Define the service QName and port QName */
      /*******************************************/
      QName servQN = new
QName("urn:xmltoday-delayed-quotes","GetQuoteService");
      QName portQN = new
QName("urn:xmltoday-delayed-quotes","GetQuoteMail");

        // create service using new engine config and name (new constructor)
        Service service = new Service(config, servQN);
        Call call = (Call) service.createCall(portQN, "getQuote");

        call.setSOAPActionURI("GetQuoteService") ;
        call.setTransport(new MailTransport());

        call.setTargetEndpointAddress( new URL(opts.getURL()) );
        call.addParameter( "symbol", XMLType.XSD_STRING, ParameterMode.IN );
        call.setReturnType( XMLType.XSD_FLOAT );

I found a potential solution by looking at the http transport class and
noticing that if the service is not set and the soap action header is, then
the soap action is transferred into the service on the message context.
Making this change to MailWorker sorted it out:

                if (soapActionString != null) {
                    msgContext.setUseSOAPAction(true);
                    msgContext.setSOAPActionURI(soapActionString);

                    // NEW Allow the SOAPAction to determine the service, if
the service
                    // (a) has not already been determined, and (b) if a
service matching
                    // the soap action has been deployed.
                    if (msgContext.getService() == null) {
                        log.debug("Setting target service to: " +
msgContext.getSOAPActionURI()) ;
                        msgContext.setTargetService((String)
msgContext.getSOAPActionURI());
                    }
                    // END NEW
                }

But I am still unsure where the targetService SHOULD have been set? What is
the intention of the SOAP action header?

Thanks, tim