web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Change CallContext TimeOut

(0) ShareShare
ReportReport
Posted on by 1,040

I created a web service in AX and I want to consume it in Java application. The default timeout to get the response back from AX is 60s. I was wondering how can I changed the callcontext time out?

Note: I get timeout in java side NOT AX side. Somehow I should change the Callcontext timeout. Below is the auto generated callcontext file.

 

package com.microsoft.schemas.dynamics._2010._01.datacontracts;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring;


/**
 * <p>Java class for CallContext complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="CallContext">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="Company" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="Language" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="LogonAsUser" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="MessageId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="PropertyBag" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOfKeyValueOfstringstring" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CallContext", propOrder = {
    "company",
    "language",
    "logonAsUser",
    "messageId",
    "propertyBag"
})
public class CallContext {

    @XmlElementRef(name = "Company", namespace = "http://schemas.microsoft.com/dynamics/2010/01/datacontracts", type = JAXBElement.class)
    protected JAXBElement<String> company;
    @XmlElementRef(name = "Language", namespace = "http://schemas.microsoft.com/dynamics/2010/01/datacontracts", type = JAXBElement.class)
    protected JAXBElement<String> language;
    @XmlElementRef(name = "LogonAsUser", namespace = "http://schemas.microsoft.com/dynamics/2010/01/datacontracts", type = JAXBElement.class)
    protected JAXBElement<String> logonAsUser;
    @XmlElementRef(name = "MessageId", namespace = "http://schemas.microsoft.com/dynamics/2010/01/datacontracts", type = JAXBElement.class)
    protected JAXBElement<String> messageId;
    @XmlElementRef(name = "PropertyBag", namespace = "http://schemas.microsoft.com/dynamics/2010/01/datacontracts", type = JAXBElement.class)
    protected JAXBElement<ArrayOfKeyValueOfstringstring> propertyBag;

    /**
     * Gets the value of the company property.
     * 
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public JAXBElement<String> getCompany() {
        return company;
    }

    /**
     * Sets the value of the company property.
     * 
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public void setCompany(JAXBElement<String> value) {
        this.company = ((JAXBElement<String> ) value);
    }

    /**
     * Gets the value of the language property.
     * 
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public JAXBElement<String> getLanguage() {
        return language;
    }

    /**
     * Sets the value of the language property.
     * 
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public void setLanguage(JAXBElement<String> value) {
        this.language = ((JAXBElement<String> ) value);
    }

    /**
     * Gets the value of the logonAsUser property.
     * 
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public JAXBElement<String> getLogonAsUser() {
        return logonAsUser;
    }

    /**
     * Sets the value of the logonAsUser property.
     * 
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public void setLogonAsUser(JAXBElement<String> value) {
        this.logonAsUser = ((JAXBElement<String> ) value);
    }

    /**
     * Gets the value of the messageId property.
     * 
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public JAXBElement<String> getMessageId() {
        return messageId;
    }

    /**
     * Sets the value of the messageId property.
     * 
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link String }{@code >}
     *     
     */
    public void setMessageId(JAXBElement<String> value) {
        this.messageId = ((JAXBElement<String> ) value);
    }

    /**
     * Gets the value of the propertyBag property.
     * 
     * @return
     *     possible object is
     *     {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >}
     *     
     */
    public JAXBElement<ArrayOfKeyValueOfstringstring> getPropertyBag() {
        return propertyBag;
    }

    /**
     * Sets the value of the propertyBag property.
     * 
     * @param value
     *     allowed object is
     *     {@link JAXBElement }{@code <}{@link ArrayOfKeyValueOfstringstring }{@code >}
     *     
     */
    public void setPropertyBag(JAXBElement<ArrayOfKeyValueOfstringstring> value) {
        this.propertyBag = ((JAXBElement<ArrayOfKeyValueOfstringstring> ) value);
    }

}

 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    AXT Profile Picture
    1,699 on at
    RE: Change CallContext TimeOut

    Found the solution the hard way, but learned a lot. WSDL exposed is using implicit SOAP headers for CallContext. You find a very good explanation here. To incorporate implicit SOAP headers into web service calls you have to use wsimport with option -XadditionalHeaders. Now Service call works perferctly including NTLM authentication for Trusted Intermediary and Impersonating with a Claim user.

  • AXT Profile Picture
    1,699 on at
    RE: Change CallContext TimeOut

    Ali, may i ask how you exactely created  the Java client code?

    We have to integrate PLM Enterprise Application that consumes AX service deployed to IIS. For testing purposes I created a custom Aif Service and deployed it to IIS. Consuming the service from VS works perfectly.  

    For creating Java client code is used "wsimport". Basically generating java client code works but somehow the Request and Response Classes are missing "CallContext". I tried as well with SalesOrderService as in your example above but i'm missing as well "CallContext" in SalesOrderServiceCreateResponse Class.

    When generating Java client code with "wsimport" i also get a warning: [WARNING] Port "reqReplyEndpoint" does not contain any usable operations. Don't know if this problem is related to this warning.

    Do I miss specific "wsimport"parameters for reading wsdl? I would very much appreciate if you could post your "wsimport" command line that generated correct Java client code in your case.

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Change CallContext TimeOut

    WCF uses several different timeouts - changing just one may make no difference.

    Note that I'm not experienced with service clients in Java, if you need details about the Java API, you should ask in a forum about Java, not Dynamics AX.

  • Ali R Profile Picture
    1,040 on at
    RE: Change CallContext TimeOut

    Actually I have AX service that is consumed in Java Web service(Above code). The problem is when I send request using the above code and if it takes more than 60 seconds in AX, I get timeout error with below message in java side. 

    java.net.SocketTimeoutException: Read timed out

    I tried to set timeout using the below code but still it is 60s. 

    ((BindingProvider)port).getRequestContext().put("javax.xml.ws.client.connectionTimeout", "120000");
    
    ((BindingProvider) port).getRequestContext().put("javax.xml.ws.client.receiveTimeout", "120000");

    Any idea how can I change that time out? 

    Here is my code in Java web service that call AX web service. 

    public SalesOrderServiceCreateResponse create(
                SalesOrderServiceCreateRequest request, CallContext callContext)
                throws SalesOrderServiceCreateAifFaultFaultFaultMessage {
    	com.microsoft.schemas.dynamics._2010._01.datacontracts.ObjectFactory factory =  new com.microsoft.schemas.dynamics._2010._01.datacontracts.ObjectFactory();
    	CallContext context = factory.createCallContext();
    	context.setCompany(factory.createCallContextCompany("USA"));
            SalesOrderService port = getService();
    
    //Set timeout until a connection is established
    ((BindingProvider)port).getRequestContext().put("javax.xml.ws.client.connectionTimeout", "120000");
    
    //Set timeout until the response is received
    ((BindingProvider) port).getRequestContext().put("javax.xml.ws.client.receiveTimeout", "120000");        
    
    return port.create(request, callContext);
        }
     
    private SalesOrderService getService() {
            RoutingService service = new RoutingService(url, QNAME_ROUTINGSERVICE);
            return service.getBasicHttpBindingSalesOrderService();
        }


  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Change CallContext TimeOut

    I'm sorry, I don't understand how is your code related to timeouts. It's also not clear to me where and when you get an error about "that it is not compatible with microsoft dynamic callcontext" and what's not compatible. Could you tell us a little bit more?

  • Ali R Profile Picture
    1,040 on at
    RE: Change CallContext TimeOut

    Agree. But when I use this I get error that it is not compatible with microsoft dynamic callcontext. Here is my code to send my request to service.

    public SalesOrderServiceCreateResponse create(
                SalesOrderServiceCreateRequest request, CallContext callContext)
                throws SalesOrderServiceCreateAifFaultFaultFaultMessage {
    	com.microsoft.schemas.dynamics._2010._01.datacontracts.ObjectFactory factory =  new com.microsoft.schemas.dynamics._2010._01.datacontracts.ObjectFactory();
    	CallContext context = factory.createCallContext();
    	context.setCompany(factory.createCallContextCompany("USA"));
            SalesOrderService port = getService();
            return port.create(request, callContext);
        }
    
    private SalesOrderService getService() {
            RoutingService service = new RoutingService(url, QNAME_ROUTINGSERVICE);
            return service.getBasicHttpBindingSalesOrderService();
        }


  • Suggested answer
    Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Change CallContext TimeOut

    I don't believe you're on a right track. Timeouts are configured for the service client, not included in data context of a call.

    Look at How do I set the timeout for a JAX-WS webservice client? instead.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans